| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use Test::More tests => 5; |
| 4 |
use Date::Format qw(time2str strftime); |
| 5 |
|
| 6 |
# RT#52387: seconds since the Epoch, UCT |
| 7 |
{ |
| 8 |
my $time = time; |
| 9 |
my @lt = localtime($time); |
| 10 |
is(strftime("%s", @lt), $time, "RT#52387: strftime %s returns epoch"); |
| 11 |
is(time2str("%s", $time), $time, "RT#52387: time2str %s returns epoch"); |
| 12 |
|
| 13 |
# strftime %s with explicit timezone must still return the same epoch — |
| 14 |
# %s is timezone-agnostic (Unix timestamp is always UTC-based). |
| 15 |
is(strftime("%s", @lt, "UTC"), $time, "RT#52387: strftime %s with UTC tz returns epoch"); |
| 16 |
is(strftime("%s", @lt, "+0000"), $time, "RT#52387: strftime %s with +0000 tz returns epoch"); |
| 17 |
is(strftime("%s", @lt, "+0100"), $time, "RT#52387: strftime %s with +0100 tz returns epoch"); |
| 18 |
} |