Displaying 1 result from an estimated 1 matches for "viaposixlt1".
2008 Apr 10
1
ISOdate/ISOdatetime performance suggestions, other date/time questions
...implementations are given
origin = as.POSIXct("1970-01-01")
mean(sapply(1:25,function(i) system.time(
as.POSIXlt(rep(origin,600000))
))[1,])
# [1] 0.3972
mean(sapply(1:25,function(i) system.time(
as.POSIXlt(seq(origin, origin, length.out=600000))
))[1,])
# [1] 0.30528
posix.viaPOSIXlt1 = function(x) {
origin = as.POSIXct("1970-01-01")
z = as.POSIXlt(seq(origin, origin, length.out=length(x)))
date = trunc(x at .Data)
time = round(1e6*x at .Data%%1,2)
rtime = round(time)
z$sec=rtime%%1e2 + time%%1
z$min=(rtime%/%1e2)%%1e2
z$hour=rtime%/%1e...