r30293 - docs/Perl6/Spec/S32-setting-library

2010-04-03 Thread pugs-commits
Author: lue
Date: 2010-04-03 20:18:43 +0200 (Sat, 03 Apr 2010)
New Revision: 30293

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[P6 Spec] completely changed S32::Temporal

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-04-03 13:03:58 UTC 
(rev 30292)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod2010-04-03 18:18:43 UTC 
(rev 30293)
@@ -17,12 +17,13 @@
 Tim Nelson 
 Daniel Ruoso 
 Dave Rolsky 
+Matthew (lue) 
 
 =head1 VERSION
 
 Created: 19 Mar 2009 extracted from S29-functions.pod and S16-IO.pod
 
-Last Modified: 18 Feb 2010
+Last Modified: 2 Apr 2010
 Version: 6
 
 The document is a draft.
@@ -31,224 +32,144 @@
 repository under /docs/Perl6/Spec/S32-setting-library/Temporal.pod so edit it 
there in
 the SVN repository if you would like to make changes.
 
-=head1 Roles
+=head1 Temporal
 
-=head2 Instant
+Time is just a jumbled iTem.
 
-The epoch used in Perl 6 to represent time instants is the
-International Atomic Time - TAI - which is independent of calendars,
-timezones as well as leap seconds. Of course Perl can't go beyond the
-machine to get a real TAI value, but it should perform any
-platform-specific transformation to give you the most precise value it
-can for the TAI.
+Temporal is divided into two parts: date and time.
 
- our Instant sub time()
+=head2 Time
 
-Returns a TAI epoch value for the current time.
+Time is called upon as such:
 
-=head2 Duration
-
-Duration objects describe an amount of time, it's the fundamental type
-for time math. The base Duration object is only TAI-seconds aware, but
-if you use its constructor with any other parameters it will delegate
-to Gregorian::Duration in order to make the most common cases easier.
-
-The following attribute is declared:
-
 =over
 
-=item tai
+=item Time.new($timesystem = $*CLOCK, $time = $*NOW)
 
-Returns the amount of TAI seconds described in this duration. Note
-that usually you shouldn't be doing math with the result of .tai for
-different datetime and duration objects. The result of .tai might also
-be an estimated value for Duration types that depend on an anchor date
-(i.e.: 1 month).
+Creates a new Time object. $timesystem is what clock you wish to use. If 
unspecified, whatever is in $*CLOCK is used. $time specifies the $time, it 
defaults to what is in $*NOW. What you enter in $time should match the format 
that $timesystem is in. $*NOW and $*CLOCK should be specified in the same 
format (i.e., if $*CLOCK is 'unixepoch', $*NOW should be something like 
127666216.432)
+Possible (string!) values for $timesystem (and therefore $*CLOCK) are:
 
-=back
-
-=head2 Calendar
-
-Every DateTime needs to follow the rules of a given calendar. The
-default is the Gregorian calendar, but several other calendars exist
-in the real world.
-
-The current default calendar is stored in $*CALENDAR.
-
 =over
 
-=item method calendartime($epoch = time(), *%options)
+=item * 12hour
 
-=item multi calendartime($epoch = time(), $calendar = $*CALENDAR, *%options)
+=item * 24hour (this and 12hour are essentialy the same system, but for 
simplicity they are separate)
 
-Returns a DateTime object in the current calendar for the given TAI
-epoch time. Each calendar type might accept different options.
+=item * hextime
 
-Note that simply changing the current calendar is not magically going
-to make any code portable to different calendars. The code using it
-should either use only the methods in the generic Calendar and
-DateTime roles, or special case for the known Calendars.
+=item * unixepoch
 
-=item method formatter is rw
+=item * tai
 
-The default formatter object used for DateTime objects in this
-calendar.
-
 =back
 
-=head2 Calendar::TimeZoneObservant
+If the time system you want is not up on the list, you are at the mercy of the 
implementation (which can, of course, add in rarer time systems) and/or 
available libraries and other addons. A shortcut to the time (in the default as 
defined by $*CLOCK) is through the $*TIME variable.
 
-This is a generic role used to identify all calendars that observe the
-time zones. Not all calendars are time-zone observants. One way or
-another, two multi subs will be available that depend on a time-zone
-observant calendar. They will fail if you try to call them with a
-non-tz calendar.
+=item Time.convert($convertto = $*CLOCK)
 
-This role also implies that the calendartime method might receive a
-time-zone named parameter.
+returns the time converted to the time system specified in $convertto. If you 
were to call convert(), then it would default to what's in $*CLOCK
 
-=over
+=item Time.format($formatto)
 
-=item method gmtime($epoch = time(), *%options )
+returns the time formatted to the way specified in $formatto. If the time has 
no options for formatting (for example hextime can be either 3_A0_9 or .3A

Re: r30293 - docs/Perl6/Spec/S32-setting-library

2010-04-03 Thread Mark J. Reed
On Sat, Apr 3, 2010 at 2:18 PM,  wrote:

> [P6 Spec] completely changed S32::Temporal
>

What motivated these changes?


> +Time is just a jumbled iTem.
>

iTem?


> +=item * 12hour
>
> +=item * 24hour


I don't like using strings for these.  Feels like they should be symbols,
but they they can't start with digits. Maybe "ampm" for 12-hour and "iso"
for 24-hour?

> (i.e. if $*CALENDAR is 'Gregorian' $*TODAY should be something like
> '12-31-10', depending on how things are formatted)
>

What determines how things should be formatted?  Using strings in code to
construct dates is bad - see AppleScript.  I'd much rather see you have to
specify  :year(), :month(), and :day().

+=item * Julian (the predecessor of Gregorian. NOT the astronomical Julian
> Year)
>

That's an awfully loud caveat, especially since it's incorrect.  The
astronomical Julian year is the mean year of the  predecessor of the
Gregorian calendar.  Since they're the same thing, confusing them is not
really a concern.

(Astronomers use the Julian calendar because a Julian century is a whole
number of days, whereas in the Gregorian calendar you have to get to 400
years before you have a repeatable whole-day cycle).