develooper Front page | perl.perl6.language.datetime | Postings from September 2000

RFC 99 (v3) Standardize ALL Perl platforms on UNIX epoch

Thread Previous | Thread Next
Perl6 RFC Librarian
September 13, 2000 10:52
RFC 99 (v3) Standardize ALL Perl platforms on UNIX epoch
Message ID:
This and other RFCs are available on the web at

=head1 TITLE

Standardize ALL Perl platforms on UNIX epoch

=head1 VERSION

  Maintainer: Nathan Wiger <>
  Date: 14 Aug 2000
  Last-Modified: 12 Sep 2000
  Mailing List:
  Number: 99
  Version: 3
  Status: Developing


Currently, internal time in Perl is maintained via C<time>, which is
highly system-dependent. On some systems, this is relative to the UNIX
epoch, while others use their own epochs (MacPerl uses 1904, for

All versions of Perl on all platforms should maintain time both
internally and externally as seconds since the UNIX epoch (00:00:00 01
Jan 1970 UTC).


Time is a dicey issue. While everyone disagrees on what the "right"
epoch is to use, everyone generally agrees that time synchronization
across different versions of Perl is a good thing.

The UNIX epoch is already a widely-established standard and seems as
good as any. This has the added benefit that most users will see no
change, since most users use a version of Perl which is already based on
the UNIX epoch.


A simplistic Perl 5 implementation of this can be found as Time::Unix

The C<time> core function must be changed to return the number of
seconds since the UNIX epoch on ALL platforms. Note this behavior is
inconsistent with previous versions of C<time> and must be noted clearly
in the documentation.

In addition, a C<systime> function should be added which provides access
to the native epoch/system time. For simplification, it might be best if
this C<systime> function remain the basis for other library-related
functions, such as C<stat>, C<lstat>, and so on, which typically rely on
native system time.

An alternative to C<systime>, proposed by Chaim Frenkel, is to have a
C<time> object which is magical yet walks and talks like a number (much
like the C<date> objects proposed in RFC 48). In the author's opinion,
either method is quite suitable (in fact I tend to like Chaim's idea a

=head1 CHANGES

Version 2:
   1. Added extra implementation notes
   2. Wrote a I<very> simple Perl 5 implementation

Version 1 of this RFC was entitled 
"Maintain internal time in Modified Julian (not epoch)".


RFC 48: Replace localtime() and gmtime() with date() and utcdate()

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About