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
From:
Perl6 RFC Librarian
Date:
September 13, 2000 10:52
Subject:
RFC 99 (v3) Standardize ALL Perl platforms on UNIX epoch
Message ID:
20000913071030.26148.qmail@tmtowtdi.perl.org
This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

Standardize ALL Perl platforms on UNIX epoch

=head1 VERSION

  Maintainer: Nathan Wiger <nate@wiger.org>
  Date: 14 Aug 2000
  Last-Modified: 12 Sep 2000
  Mailing List: perl6-language-datetime@perl.org
  Number: 99
  Version: 3
  Status: Developing

=head1 ABSTRACT

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
example).

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).

=head1 DESCRIPTION

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.

=head1 IMPLEMENTATION

A simplistic Perl 5 implementation of this can be found as Time::Unix
http://www.perl.com/CPAN/authors/id/N/NW/NWIGER/Time-Unix-1.02.tar.gz

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
lot).

=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)".

=head1 REFERENCES

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

http://www.mail-archive.com/perl6-language-datetime%40perl.org/msg00001.html

http://www.mail-archive.com/perl6-language-datetime%40perl.org/msg00002.html

http://www.mail-archive.com/perl6-language-datetime%40perl.org/msg00025.html


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About