How can I get the current time in milliseconds? I tried the below without success:
> strptime(Sys.time(), "%Y-%m-%d %H:%M:%OS")
[1] "2022-05-14 19:42:53 CEST
How can I get the current time in milliseconds? I tried the below without success:
> strptime(Sys.time(), "%Y-%m-%d %H:%M:%OS")
[1] "2022-05-14 19:42:53 CEST
You do get milliseconds by default on all operating systems, and (almost as the effective resolution is just a fraction less) microseconds on Linux and macOS -- but you must enable the printing of it.
> options(digits.secs=0)
> Sys.time()
[1] "2022-05-14 13:01:57 CDT"
>
> options(digits.secs=6)
> Sys.time()
[1] "2022-05-14 13:02:54.038276 CDT"
>
I actually set this in my default ~/.Rprofile to always have six decimals.