Re: mktime normalization without local/daylight adjustment
On Mon, 17 Sep 2007 12:04:35 -0700, "cbdeja@my-deja.com"
<cbdeja@my-deja.com> wrote:
I'm zeroing the whole structure before assigning the values, so
tm_isdst *is* set to zero on entry.
On exit tm_isdst is set to 1, and the hour is 1 hour too large.
Any other ideas?
On second thought, you might have better luck setting it to -1, but even
that may have edge cases. Unfortunately, the Standard C Library doesn't
provide an API that allows you to work solely with absolute times. The
mktime function takes a broken-down time that is expressed as a local time,
and it appears you can't fully escape the DST issue. I don't have time to
research this any further, so you might want to ask in
comp.std.c/comp.lang.c or at least google those groups for mktime/tm_isdst.
Maybe someone there has clearly explained the purpose of tm_isdst, and I
missed it.
At the Windows API level, the SYSTEMTIME/FILETIME functions might be
useful. When you do encounter DST in Windows, be aware that Windows has
some funny rules about DST, which you can read about here:
http://blogs.msdn.com/oldnewthing/archive/2003/10/24/55413.aspx
http://support.microsoft.com/kb/932955
--
Doug Harrison
Visual C++ MVP