[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Weird time-zone oscillation



On Sun, Dec 13, 2009 at 02:47:38PM -0600, Kumar Appaiah wrote:
> OK, there's a bug in your program:
> 
> #include <stdio.h>
> #include <time.h>
> 
> int main(void) {
> 	char *iso_date = "2009-12-11T2:50:00";
> 	struct tm tm; /* <- NOT INITIALIZED! */
> 	time_t time;
> 
> 	strptime(iso_date, "%FT%T", &tm);
> 	time = mktime(&tm);
> 	printf("%ld\t%d\n", time, tm.tm_isdst);
> 	return 0;
> }
> 
> If I 	memset(&tm, 0, sizeof(struct tm));, the bug goes away.
> 
> Here's the deal: The same bug exists glib. No wonder! The maintainer
> of alarm-clock helped me figure that out, and will reassign the bug to
> glib (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558099 )
> 
> Thanks, all, for helping me. Sorry for wasting your time.

FYI: http://git.gnome.org/cgit/glib/commit/?id=2321e5aed07154761223bb124770beba56700e41

Kumar
-- 
"MSDOS didn't get as bad as it is overnight -- it took over ten years
of careful development."
(By dmeggins@aix1.uottawa.ca)

Attachment: signature.asc
Description: Digital signature


Reply to: