houseabsolute / Time-Local

Efficiently compute time from local and GMT time
https://metacpan.org/release/Time-Local/
Other
4 stars 11 forks source link

Suggest: Use timelocal_modern/timegm_modern in SYNOPSIS #10

Closed skaji closed 3 years ago

skaji commented 5 years ago

If you strongly encourage us to use timelocal_modern/timegm_modern instead of timelocal/timegm, then why don't you use timelocal_modern/timegm_modern in SYNOPSIS too?

autarch commented 5 years ago

Good point. A PR would be welcome.

skaji commented 5 years ago

Nice!

... I noticed that just changing SYNOPSIS may conflict with the following sentence:

This module provides functions that are the inverse of built-in perl functions localtime() and gmtime().

skaji commented 5 years ago
use Time::Local qw(timelocal timegm timelocal_modern timegm_modern);

my $time = time;

# These are true
$time == timelocal localtime $time;
$time == timegm gmtime $time;

# These are false
$time == timelocal_modern localtime $time;
$time == timegm_modern gmtime $time;
autarch commented 5 years ago

Yeah, I wonder if it's better to rethink these subs (or provide yet another version that is truly reversable). Bleah, it's a bit of a mess.

skaji commented 5 years ago

I prefer that Time-Local provides functions that are truly reversible. On the other hand, I also agree with you that it is a mess :/

autarch commented 3 years ago

The new *_posix functions are now the ones shown in the SYNOPSIS.