This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
LIBC - improve strptime()
- From: Gary Thomas <gary at mlbassoc dot com>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 18 Mar 2003 07:34:52 -0700
- Subject: LIBC - improve strptime()
Index: language/c/libc/time/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/language/c/libc/time/current/ChangeLog,v
retrieving revision 1.13
diff -u -5 -p -r1.13 ChangeLog
--- language/c/libc/time/current/ChangeLog 24 Feb 2003 14:28:38 -0000 1.13
+++ language/c/libc/time/current/ChangeLog 18 Mar 2003 14:33:35 -0000
@@ -1,5 +1,10 @@
+2003-03-18 Gary Thomas <gary at mlbassoc dot 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 at eCosCentric dot com>
* cdl/time.cdl: Fix doc link.
2003-01-28 Jonathan Larmour <jifl at eCosCentric dot com>
Index: language/c/libc/time/current/src/strptime.cxx
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/language/c/libc/time/current/src/strptime.cxx,v
retrieving revision 1.1
diff -u -5 -p -r1.1 strptime.cxx
--- language/c/libc/time/current/src/strptime.cxx 27 Jan 2003 22:10:15 -0000 1.1
+++ language/c/libc/time/current/src/strptime.cxx 18 Mar 2003 14:09:22 -0000
@@ -183,12 +183,20 @@ set_week_number_mon4 (struct tm *timeptr
char *
strptime (const char *buf, const char *format, struct tm *timeptr)
{
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;
int ret;
--
------------------------------------------------------------
Gary Thomas |
MLB Associates | Consulting for the
+1 (970) 229-1963 | Embedded world
http://www.mlbassoc.com/ |
email: <gary at mlbassoc dot com> |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------