I am facing an issue, and I suspect it's a bug in POSIXct, or a rounding error, but how to prevent it ?
When the millisecond in datetime is exactly 1 in the following format, the millisecond get skipped (become 0). This does not happen for any other millisecond value.
> as.POSIXct("2023-08-03T14:25:00.001Z" , format = "%Y-%m-%dT%H:%M:%OSZ" , tz = "UTC")
[1] "2023-08-03 14:25:00.000 UTC"
Trying to extend to 6 digits and we also loose the last digit (e-6 seconds)
> as.POSIXct("2023-08-03T14:25:00.001001Z" , format = "%Y-%m-%dT%H:%M:%OSZ" , tz = "UTC") %>% strftime(format = "%Y-%m-%dT%H:%M:%OS6Z")
[1] "2023-08-03T16:25:00.001000Z"
R Version :
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 4
minor 3.0
year 2023
month 04
day 21
svn rev 84292
language R
version.string R version 4.3.0 (2023-04-21)
nickname Already Tomorrow