# HG changeset patch # User gthomas # Date 1047998046 0 # Node ID 6fa00a58a22902303ef82e44b63090c9e56e1048 # Parent 68468dc734f49942db8c2bc28d7f3effd94a60a1 Initialize time structure to known [legal] value. diff --git a/packages/language/c/libc/time/current/ChangeLog b/packages/language/c/libc/time/current/ChangeLog --- 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 + + * 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 * cdl/time.cdl: Fix doc link. diff --git a/packages/language/c/libc/time/current/src/strptime.cxx b/packages/language/c/libc/time/current/src/strptime.cxx --- 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;