1nickt has asked for the wisdom of the Perl Monks concerning the following question:
Learned brethren,
I have a module that uses Time::Moment to produce timestamps for logging. The timestamps are supposed to be to microsecond accuracy. The code:
produces timestamps with six decimal places wherever I use it on Linux and Darwin. This I expect because the doc shows:time => Time::Moment->now_utc->strftime('%FT%T%6f%Z')
I've released a module to the CPAN using this code, and it failed on a Windows tester:%f
Replaced by the fractional second including the preceding decimal point or by an empty string if no fractional seconds are present.%3f is replaced by decimal point and exactly three fractional digits (zero-padded on the right or truncated if needed) if fractional seconds are present.
# at t/013-context.t line 28. # Using Regexp on $data->{"time"} # got : '2021-05-01T18:58:28Z' # expect : (?^:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{0,6}Z$) # Looks like you failed 1 test of 1.
So my question is whether this is something that is known to occur in Strawberry Perl on Windows, or did I make a mistake in reading the doc, or ... ?
Thanks for any suggestions!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Time::Moment precision on Windows?
by 1nickt (Canon) on May 01, 2021 at 21:25 UTC | |
|
Re: Time::Moment precision on Windows?
by johnaj (Sexton) on May 01, 2021 at 21:22 UTC |