My man pages say that %e is the same as %d, i.e., the day of the month.(Update: I need glasses...OP is %s not %e) That said, you don't have to 'parse' an epoch, you just pass it to new():
use strict;
use warnings;
use Time::Piece;
my $e = time();
my $t = Time::Piece->new($e);
print Time::Piece->VERSION, "\n";
print "Input $e\n";
print "Output ".$t->epoch(), "\n";
print $t, "\n";
print $t->strftime, "\n";
I am not looking for way to parse epoch, I am investigating why strptime with %s works wrong.
Um, strptime is a function that (I think) is short for string-parse-time, and %s is the field descriptor for epoch, so I think you are trying to parse an epoch, whether you realize it or not.
No, I actually have a function which accepts strptime-like-format and data to parse and parses it. So I need strptime functionality and other ways to parse epoch are useless to me.
Time::Piece includes its own version of strptime(); there is no call to libc function. This embedded C function returns a got_GMT value which, however, is simply discarded. A value of 0 is always returned to perl side, corresponding with the islocal flag. One end of the module does not know or care what the other end is doing....