This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13401] calling localtime() or mktime() with a time far in the past corrupts cached timezone info


http://sourceware.org/bugzilla/show_bug.cgi?id=13401

--- Comment #2 from Antoine Pitrou <pitrou at free dot fr> 2011-11-21 15:00:13 UTC ---
These fields are "overwritten" by hand in the example for ease of reproduction.
The actual use case is to fill the members of a struct tm by hand from user
data. Since tm_gmtoff and tm_zone are not specified by POSIX, they are left
alone, zero-filled (the struct is previously initialized with memset()).
There's no portable way that I know of to initialize these fields.

While the most basic use of strftime() indeed consists in formatting a struct
tm returned by a libc function (such as gmtime()), it seems reasonable to use
strftime() to format user-defined time data. Nowhere does POSIX seem to say
that the struct tm *has* to come from gmtime() or similar functions.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]