Convert NET ticks to POSIXct datetime

ticks2datetime(ticks, tz = "GMT")

datetime2ticks(x)

Arguments

ticks

values in NET ticks format

tz

timezone, passed to as.POSIXct

x

values in date-time format coerced to ticks

Details

reference: https://stackoverflow.com/questions/35240874/r-net-ticks-to-timestamp-in-r

See also

Other gt3x-utils: get_n_samples(), is_gt3x()

Other gt3x-utils: get_n_samples(), is_gt3x()

Examples

mystr = "599633592352500000" x = read.gt3x::ticks2datetime(mystr) x
#> [1] "1901-03-02 08:40:36.25 GMT"
out = read.gt3x::datetime2ticks(as.POSIXct("1901-03-02 08:40:35.25", tz = "UTC")) out = as.character(out) out
#> [1] "599633592352500000"
stopifnot(out == mystr) read.gt3x::datetime2ticks(x = as.POSIXct(Sys.time(), tz = "EST"))
#> Warning: date time object not in UTC/GMT, should use lubridate::with_tz or lubridate::tz to change before making ticks
#> Warning: unknown timezone 'LMT'
#> Warning: unknown timezone 'LMT'
#> Warning: unknown timezone 'LMT'
#> Warning: unknown timezone 'LMT'
#> [1] "637461434341480000"