Following on from: How R formats POSIXct with fractional seconds, I have two distinct (character) timestamps that are converted to the same POSIXct value using fastPOSIXct
from the fasttime
package:
library(fasttime)
tmpstmp <- c("2010-03-01 12:41:52.713",
"2010-02-01 12:41:52.714")
options(digits.secs = 6) # note that this is required to display fractional seconds in R.
fastPOSIXct(tmpstmp)
giving
> fastPOSIXct(tmpstmp)
[1] "2010-03-01 23:41:52.713 AEDT" "2010-02-01 23:41:52.713 AEDT"
which is very undesirable behaviour. My workaround is to concatenate 10 microseconds, so that I now have
tmpstmp <- c("2010-03-01 12:41:52.71301",
"2010-02-01 12:41:52.71401")
giving
> fastPOSIXct(tmpstmp)
[1] "2010-03-01 23:41:52.71301 AEDT" "2010-02-01 23:41:52.71401 AEDT"
I would now like to round this POSIXct object down to the nearest millisecond. How do I do this?