Re: [PATCH] Add a new lstat and fstat implementation based on Win32 API

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

 



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 <windows.h>
#include <stdio.h>
#include <time.h>

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;
}

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux