[Scheme-reports] Date/time package John Cowan (10 May 2012 16:56 UTC)
Re: Date/time package Arthur A. Gleckler (10 May 2012 17:09 UTC)
Re: [Scheme-reports] Date/time package Peter Bex (10 May 2012 18:54 UTC)
Re: [Scheme-reports] Date/time package John Cowan (10 May 2012 21:07 UTC)
Re: [Scheme-reports] Date/time package Peter Bex (10 May 2012 21:58 UTC)
Re: [Scheme-reports] Date/time package Alan Watson (10 May 2012 22:07 UTC)
Re: [Scheme-reports] Date/time package Noah Lavine (10 May 2012 22:41 UTC)
Re: [Scheme-reports] Date/time package John Cowan (11 May 2012 02:43 UTC)
Re: [Scheme-reports] Date/time package John Cowan (11 May 2012 02:16 UTC)
Re: [Scheme-reports] Date/time package Peter Bex (11 May 2012 10:05 UTC)
Re: [Scheme-reports] Date/time package Peter Bex (11 May 2012 10:13 UTC)
Re: [Scheme-reports] Date/time package John Cowan (11 May 2012 14:35 UTC)
Re: [Scheme-reports] Date/time package John J Foerch (10 May 2012 23:40 UTC)
Re: [Scheme-reports] Date/time package John Cowan (11 May 2012 03:01 UTC)
Re: [Scheme-reports] Date/time package John J Foerch (11 May 2012 04:37 UTC)
Re: [Scheme-reports] Date/time package John Cowan (11 May 2012 04:44 UTC)
Re: [Scheme-reports] Date/time package John J Foerch (11 May 2012 05:25 UTC)
Re: [Scheme-reports] Date/time package Daniel Villeneuve (11 May 2012 03:35 UTC)

[Scheme-reports] Date/time package John Cowan 10 May 2012 16:55 UTC

Peter Bex scripsit:

> I think a comfortable, complete date/time-manipulation is one thing that
> Scheme is sorely lacking.  We have SRFI-19, but it is a bit unwieldy and
> not very complete.

I have written up a proposal for WG2 which can be found at
http://trac.sacrideo.us/wg/wiki/TimeAdvancedCowan , with a supplement
on durations and intervals at http://trac.sacrideo.us/wg/wiki/TimePeriodsCowan .
It's based loosely on the Java package JodaTime, but adapted to the nature
of a dynamically typed language.  It is certainly comprehensive; how
comfortable it is, is for others to judge.

If anyone's interested, please take a look and comment here.

> (How, for example, do you convert a given time in a
> zone to another zone?  How do you go back a month? etc)

(define iso (chronology 'iso))
(define new-york-zone
  (chronology-with-time-zone 'America/New_York iso "America/New_York"))
(define dutch-zone
  (chronology-with-time-zone 'Europe/Amsterdam iso "Europe/Amsterdam"))

(define new-york-moment (make-date new-york-zone
  '((year . 2012) (month-of-year . 5) (day-of-month . 10)
    (hour-of-day . 12) (minute-of-hour . 19) (second-of-minute . 30))))
(define dutch-moment (convert-date dutch-zone new-york-moment))
(date-field dutch-moment 'hour-of-day) => 18

(define last-january new-york '((year . 2012) (month-of-year . 1)))
(define last-december (date-increment last-january 'month-of-year -1))
(date-field last-december 'month-of-year) => 12
(date-field last-january 'year) => 2011

--
Schlingt dreifach einen Kreis vom dies!    John Cowan <cowan@ccil.org>
Schliesst euer Aug vor heiliger Schau,     http://www.ccil.org/~cowan
Denn er genoss vom Honig-Tau,
Und trank die Milch vom Paradies.            --Coleridge (tr. Politzer)

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports