This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Fix getdate (was Re: problem with getdate)
- To: Ulrich Drepper <drepper at redhat dot com>, Andreas Jaeger <aj at suse dot de>
- Subject: [PATCH] Fix getdate (was Re: problem with getdate)
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 17 Jul 2001 11:20:23 +0200
- Cc: libc-alpha at sources dot redhat dot com, Hendrik Uhlmann <HUhlmann at stn-atlas dot de>
- References: <hoitgsrlse.fsf@gee.suse.de>
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
On Tue, Jul 17, 2001 at 10:40:17AM +0200, Andreas Jaeger wrote:
> As Hendrik reported, we seem to have a bug in getdate. Calling
> getdate twice gives different results for the value of tm_hour:
...
> The change from 5 to 6 in tm_hour occurs in the mktime call in getdate_r.
>
> I'm appending the test files. Has anybody an idea what's broken?
getdate does not initialize the whole struct tm but mktime uses it.
Should be fixed by:
2001-07-17 Jakub Jelinek <jakub@redhat.com>
* time/getdate.c (__getdate_r): Initialize tm_isdst, tm_gmtoff and
tm_zone before calling strptime.
--- libc/time/getdate.c.jj Fri Sep 1 11:38:27 2000
+++ libc/time/getdate.c Tue Jul 17 11:20:01 2001
@@ -147,6 +147,9 @@ __getdate_r (const char *string, struct
/* Do the conversion. */
tp->tm_year = tp->tm_mon = tp->tm_mday = tp->tm_wday = INT_MIN;
tp->tm_hour = tp->tm_sec = tp->tm_min = INT_MIN;
+ tp->tm_isdst = 0;
+ tp->tm_gmtoff = 0;
+ tp->tm_zone = NULL;
result = strptime (string, line, tp);
if (result && *result == '\0')
break;
Jakub