From: Johannes Sixt Date: Tue, 04 Sep 2007 13:03:51 GMT Subject: Re: [PATCH] Add a new lstat and fstat implementation based on Win32 API Message-ID: <46DD57B7.9090206@eudaptics.com> In-Reply-To: Johannes Schindelin schrieb: > On Tue, 4 Sep 2007, Johannes Sixt wrote: >> Reading the implementation of time(), it starts with GetLocalTime(), >> determines whether daylight saving is in effect, and continues with >> another round of timezone adjustment - mind you: _not_ a timezone >> reversal (!!). Doesn't this look extremely bogus? >> >> It seems we really need a wrapper for time(). > > I absolutely concur. Something like this (most of it is blatantly copied > from Marius' patch)? Well, I don't think it'll make a difference. The tiny test program below prints twice the same number. My analysis of the time() implementation is obviously flawed. -- Hannes #include #include #include int main() { time_t t = time(NULL); FILETIME ft; GetSystemTimeAsFileTime(&ft); long long winTime = ((long long)ft.dwHighDateTime << 32) + ft.dwLowDateTime; winTime -= 116444736000000000LL; winTime /= 10000000; printf("%d %d\n", t, (int) winTime); return 0; }