This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

Re: mktime()


On Aug 17, 2011, at 9:29 AM, Howland Craig D (Craig) wrote:

>    This also raises an interesting question about what to do with no
> DST (e.g. with GMT) but the user passes tm_isdst>=1.  It could be
> considered to be illegal input.  Neither the C standard nor POSIX
> comment on this case.

Hi Craig:
   POSIX does state "to presume initially that Daylight Savings Time, respectively, is or is not in effect for the specified time." Now what to do with it is left up to an implement-defined case, I believe. In the case of GMT0 mktime() can ignore, however in cases where it's not in effect, but have DST, tm_isdst should return 0, and that that returned time_t be adjusted to the found time zone offset (leaving broken-down information untouched) instead of what was used prior to calling mktime(). The "however" case I mention seems to be the current "implementation-defined" behavior I have found, and currently used. Glibc, I believe it is, has a test for this specific condition. Either way Newlib decides to go would not be considered "non-POSIX", I think. And I'm am sorry but I did not test anything beyond the GMT0 scenario.

Hope info helpful, best of luck,
Steve


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