Questions On Proposed ANSI Standard DateAndTime
James Foster
james at foster.net
Mon Jul 6 14:27:29 UTC 1998
-----Original Message-----
From: R. A. Harmon <harmonra at webname.com>
To: squeak at cs.uiuc.edu <squeak at cs.uiuc.edu>
Date: Saturday, July 04, 1998 10:53 AM
Subject: Questions On Proposed ANSI Standard DateAndTime
>Hi Squeakers:
>
>I'm trying to implement the <DateAndTime> protocol messages, but can't get
a
>feel for what their definitions mean in terms concrete enough to implement.
>I posted a question about this on the comp.lang.smalltalk news group, but
>didn't get a response. I hope someone in the Squeak community might be
able
>to help. I think I could figure out how <DateAndTime> works if I could
just
>see what the various messages do with examples of real dates and times.
Any
>help would be greatly appreciated.
> [SNIP]
>From my reading of your questions and the standard, I agree with most of
your interpretation with the following differences:
>As I understand it, a date and time in UTC means the date and time in GMT.
>So a DateAndTime class>>#year:month:day:hour:minute:second: message
>given the values for 8:00 am in California on April 26, 1997 return an
instance
>DateAndTime(97/04/26, 02:00:00, 0:06:00:00).
I believe that California is eight hours later than GMT. Thus, I think you
mean to represent 8:00 am in California on April 26, 1997 as
DateAndTime(97/04/26, 8:00:00 "local California", 0:08:00:00 "offset
to GMT")
Actually, I would prefer to represent the time as GMT internally, plus a
time offset to local (not from local):
DateAndTime(97/04/26, 0:00:00 "GMT", -08:00:00 "offset to
California")
>Is the following result of the Duration [SIC]>>#asLocal message correct?
>
> DateAndTime(97/04/26, 02:00:00, 0:06:00:00) asLocal
> ???-> DateAndTime(97/04/26, 08:00:00, 0:00:00:00)
I think you should keep (but adjust) the offset to match the local offset:
DateAndTime(97/04/26, 02:00:00, 0:06:00:00) asLocal "North
Dakota"
-> DateAndTime(97/04/26, 00:00:00, 0:08:00:00) "California"
Or, treating the internal value as GMT:
DateAndTime(97/04/26, 16:00:00, -6:00:00) asLocal "from North
Dakota"
-> DateAndTime(97/04/26, 16:00:00, -8:00:00) "California"
>Is the following result of the Duration [sic]>>#asUTC message correct?
>
> DateAndTime(97/04/26, 02:00:00, 0:06:00:00) asUTC
> ???-> DateAndTime(97/04/26, 02:00:00, 0:06:00:00)
I think you should answer a DateAndTime whose offset is zero:
DateAndTime(97/04/26, 02:00:00, 0:06:00:00) asUTC "from North
Dakota"
-> DateAndTime(97/04/26, 08:00:00, 0:00:00:00) "now local to
GMT"
Or, treating the internal value as GMT:
DateAndTime(97/04/26, 16:00:00, -6:00:00) asGMT "from North
Dakota"
-> DateAndTime(97/04/26, 16:00:00, 0:00:00) "now local to GMT"
>Should the Duration>>#< message given an operand other than an instance of
>class Duration generate an error or return false?
Asking a duration of ten minutes if it is less than the color orange does
not seem to be false unless you can come up with a way to make 10 minutes
greater than orange. I would expect an error.
>Is the correct global name DateAndTime or DateTime?
The global DateTime conforms to the protocol <DateAndTime factory>. Its
language element type is unspecified.
James Foster
More information about the Squeak-dev
mailing list
|