[R] Time conversion from Win32 64bit FILETIME?
jim holtman
jholtman at gmail.com
Thu Oct 19 18:00:07 CEST 2006
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 at 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 at 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?
More information about the R-help
mailing list