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

Re: RFC 99 (v2) Standardize ALL Perl platforms on UNIX epoch

Thread Previous | Thread Next
From:
Nathan Wiger
Date:
September 4, 2000 13:09
Subject:
Re: RFC 99 (v2) Standardize ALL Perl platforms on UNIX epoch
Message ID:
39B3F356.398EF915@wiger.org
Chaim Frenkel wrote:
> 
> Strange thought just crossed my mind.
> 
> Would having a time object that is understood by perl be sufficient?
> It would smell and taste like an integer but would otherwise be
> magical.

This is something that should be easily doable if RFC 73, "All Perl core
functions should return objects", gets adopted. Then we could easily
have time() return an object which, when in a numeric or string context,
evaluates to the UNIX epoch seconds. But it could easily have object
methods like:

   $t = time;       # Generate time object
   print $t;        # UNIX epoch
   $t++;            # UNIX epoch + 1

   $t->mjdate;      # Modified Julian Date
   $t->systime;     # System time
   $t->unix;        # UNIX epoch, same as NUMBER and STRING
   $t->judaic;      # You get the idea... :-)

Embedded objects are looking better all the time...

-Nate

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