changeset 837:6fa00a58a229

Initialize time structure to known [legal] value.
author gthomas
date Tue, 18 Mar 2003 14:34:06 +0000
parents 68468dc734f4
children 8d1a6007aeb1
files packages/language/c/libc/time/current/ChangeLog packages/language/c/libc/time/current/src/strptime.cxx
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packages/language/c/libc/time/current/ChangeLog
+++ b/packages/language/c/libc/time/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-18  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/strptime.cxx: Initialize time structure to a well known, valid,
+	time/date so even if there is an error, it still makes [some] sense.
+
 2003-02-24  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* cdl/time.cdl: Fix doc link.
--- a/packages/language/c/libc/time/current/src/strptime.cxx
+++ b/packages/language/c/libc/time/current/src/strptime.cxx
@@ -185,8 +185,16 @@ strptime (const char *buf, const char *f
 {
     char c;
 
-    timeptr->tm_yday = 1;  // So it's always valid
-    timeptr->tm_isdst = 0;
+    timeptr->tm_yday = 1;  // Initialize to a well known, valid date
+    timeptr->tm_isdst = 0; //   Tuesday March 18 14:05:00 2003 UTC
+    timeptr->tm_sec = 0;
+    timeptr->tm_min = 5;
+    timeptr->tm_hour = 24;
+    timeptr->tm_mday = 18;
+    timeptr->tm_mon = 2;
+    timeptr->tm_year = 103;
+    timeptr->tm_wday = 2;
+    timeptr->tm_yday = 77;
 
     for (; (c = *format) != '\0'; ++format) {
 	char *s;