I haven't tested on devel but looking at as.ITime.POSIXct, it's identical to the one I've on my system.
require(data.table) # v1.12.2, Rv 3.6.1
Sys.timezone()
# [1] "America/New_York"
x <- Sys.time()
x
# [1] "2019-12-02 12:24:41 EST"
as.ITime(x)
# [1] "17:24:41"
This is incorrect because tz is assumed to be UTC if attr(x, 'tzone') returns NULL which is the case for Sys.time().
> data.table:::as.ITime.POSIXct
function (x, tz = attr(x, "tzone"), ...)
{
if (is.null(tz))
tz = "UTC"
if (tz %chin% c("UTC", "GMT"))
as.ITime(unclass(x), ...)
else as.ITime(as.POSIXlt(x, tz = tz, ...), ...)
}
Why we need tz info to extract HH:MM:SS from a timestamp if I already provide a POSIXct object?
I upgraded from 1.10.4-3 which seems to not have this POSIXct method and delegates to .default, which handles it with as.ITime(as.POSIXlt(x, ...)). Looking at the POSIXct method, it seems similar to old default but with a special case for GMT/UTC. Why so?
I haven't tested on
develbut looking atas.ITime.POSIXct, it's identical to the one I've on my system.This is incorrect because
tzis assumed to beUTCifattr(x, 'tzone')returnsNULLwhich is the case forSys.time().Why we need
tzinfo to extract HH:MM:SS from a timestamp if I already provide aPOSIXctobject?I upgraded from
1.10.4-3which seems to not have thisPOSIXctmethod and delegates to.default, which handles it withas.ITime(as.POSIXlt(x, ...)). Looking at thePOSIXctmethod, it seems similar to olddefaultbut with a special case forGMT/UTC. Why so?