How i can get nanosecond from DateTime in Perl?
I try
say DateTime->from_epoch(epoch => time)->nanosecond; # 0
say DateTime->from_epoch(epoch => time)->strftime('%9N'); # 0
How i can get nanosecond from DateTime in Perl?
I try
say DateTime->from_epoch(epoch => time)->nanosecond; # 0
say DateTime->from_epoch(epoch => time)->strftime('%9N'); # 0
time
returns the number of (whole) seconds since the start of the unix epoch. Time::HiRes provides a version of time
with better resolution.
Note that Time::HiRes::time
only gives answers in steps of 2**-22 seconds or 0.24µs. (For a full explanation, see https://stackoverflow.com/a/66487325/5781773)