Re: [R] Time conversion from Win32 64bit FILETIME?

From: jim holtman <jholtman_at_gmail.com>
Date: Thu 19 Oct 2006 - 16:00:07 GMT

One way might be to convert the number to POSIXct by scaling it based that POSIXct is from 1970 and your number is from 1601. So if you subtract the difference between 1601 and 1970 then you should have a compliant number for R:

# read your number
x <- 12345678901234567890 # big number (your 64-bit time)

x.sec <- x / 10^9 # convert to seconds
xBase <- unclass(as.POSIXct('1601-1-1'))  # your time base, relative to 1970
x.sec <- x.sec - abs(xBase)  # scale to 1970
x.time <- structure(x.sec, class=c("POSIXt", "POSIXct")) # convert to POSIXct

On 10/19/06, Derek Eder <derek.eder@lungall.gu.se> wrote:
> Windows-32 has a time structure called FILETIME, a 64-bit value
> representing the number of 100-nanosecond intervals since January 1,
> 1601 (UTC). That is not a typo, the year is 1601.
>
> Does anyone have a clue(or algorhithm)for how this is converted to
> something a little more POSIX-like ?
>
> Thank you,
>
> Derek
>
> --
> Derek N. Eder
>
> Gothenburg University
> VINKLA - Vigilance and Neurocognition laboratory
>
> SU/Sahlgrenska
> Utvecklingslab 1, Med
> Gröna stråket 8
> SE 413 45 Göteborg (Gothenburg)
> Sverige (Sweden)
>
> +46 (031)* 342 8261 (28261 inom Sahlgrenska)
> +46 0704 915 714 (mobile)
> +46 (031) 25 97 07 (home)
>
> * omit the 0 when calling from outside Sweden
>
> personal web page: www.derek-eder.org
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri Oct 20 03:00:46 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 20 Oct 2006 - 01:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.