The behavior also appears to occur if I change my $t = localtime; to my $t = gmtime; as well, where the timezone is then 'UTC'.
That is very interesting. If I run your original code as posted (with Time::Piece 1.3401) with the TZ environment variable unset, it runs to completion and I see this output:
Time is: Thu, 14 Jan 2021 09:48:00 GMT Time is: Thu, 14 Jan 2021 09:48:00 UTC
Note that the textual representation of the timezone differs in the two lines of output.
If I subsequently re-run it with TZ set to apparently anything other than "GMT", then it bombs out. Even if I set it to "UTC" it will bomb out. This looks like a bug in Time::Piece .
Time is: Thu, 14 Jan 2021 10:03:32 UTC Error parsing time at /usr/local/lib64/perl5/Time/Piece.pm line 598. at tp.pl line 11. main::__ANON__("Error parsing time at /usr/local/lib64/perl5/Time/ +Piece.pm li"...) called at /usr/local/lib64/perl5/Time/Piece.pm line +598 Time::Piece::strptime("Time::Piece", "Thu, 14 Jan 2021 10:03:32 UT +C", "%a, %d %b %Y %T %Z") called at tp.pl line 23
🦛
In reply to Re: Question regarding Time::Piece and timezones
by hippo
in thread Question regarding Time::Piece and timezones
by atcroft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |