Concerning Time.TimeDiff

Graham Klyne GK@ninebynine.org
Fri, 20 Jun 2003 19:16:43 +0100


Home historical timezone offsets are sub-minutes -- there's mention of an 
example in RFC3339, at the end of section 5.8:

[[
       1937-01-01T12:00:27.87+00:20

    This represents the same instant of time as noon, January 1, 1937,
    Netherlands time.  Standard time in the Netherlands was exactly 19
    minutes and 32.13 seconds ahead of UTC by law from 1909-05-01 through
    1937-06-30.  This time zone cannot be represented exactly using the
    HH:MM format, and this timestamp uses the closest representable UTC
    offset.
]]
-- http://www.ietf.org/rfc/rfc3339.txt

Which leads mew to mention a slight unease about including time zone name 
information in the library [1].  Have you seen how many different time zone 
names there can be?  Many with different rules for daylight savings time, 
etc.  This is one of the things we chopped in producing RFC3339 from the 
earlier work.

My own feeling that it may be OK to have a facility to add a time zone name 
(or abstract structure) to a clocktime, in addition to a timezone offset, 
but I'm uneasy about having a built-in method that works it out for 
you.  Maybe, then, an external library function can be provided to do the 
name-to-offset mapping (hmmm... sounds like a possible semantic web 
application to me ;-)  Doing offset-to-name mapping would be even more 
difficult, because of non-uniqueness.

#g
--

[1] From Simon's recent proposal:
[[

-- | Make a 'Timezone' from an offset, in minutes relative to UTC,
-- which must be less than @24*60@.
timezoneFromOffset :: Int    -> Timezone

-- | Make a 'Timezone' from a standard timezone name (eg. GMT, PDT).
-- TAI is a valid timezone name.
timezoneFromName   :: String -> Timezone

-- | Return the offset in minutes of the specified timezone relative
--   to UTC.
timezoneOffset :: Timezone -> Int

-- | Return the timezone name corresponding to a 'Timezone' value.
timezoneName   :: Timezone -> String
]]
-- http://www.haskell.org/pipermail/libraries/2003-June/001207.html

At 17:14 20/06/03 +0100, Keith Wansbrough wrote:
> >    - Timezone offsets are in minutes (apparently this is necessary -
> >      if someone could provide a reference I'd be grateful).
>
>Australia.
>
>--KW 8-)
>--
>Keith Wansbrough <kw217@cl.cam.ac.uk>
>http://www.cl.cam.ac.uk/users/kw217/
>University of Cambridge Computer Laboratory.
>
>_______________________________________________
>Libraries mailing list
>Libraries@haskell.org
>http://www.haskell.org/mailman/listinfo/libraries

-------------------
Graham Klyne
<GK@NineByNine.org>
PGP: 0FAA 69FF C083 000B A2E9  A131 01B9 1C7A DBCA CB5E