On Fri, 10 Apr 2009 10:07:20 -0400, Andrei Alexandrescu <[email protected]> wrote:

Hello,

I want to port the function setFileTimes available in Phobos/Posix to Windows. Does anyone know of a simple way to convert a d_time value to a FILETIME value? d_time is Ticks since 1-1-1970 and FILETIME contains quanta of 100-nanoseconds since 1-1-1601. So there's only some shifting and scaling involved, but the shifting constant is tricky :o).

What you need is the constant that is the number of Ticks (either 100ns ticks or whatever) from 1601 to 1970.

I redid most of the tango time stuff, but those constants were already there before my time (no pun intended). The number of seconds between 1/1/1601 and 1/1/1970 is 11644473600. Scale that to whatever you wish.

Note that we do not take into account leap-seconds, not sure if that matters to you.

-Steve

Reply via email to