Doing date arithmetic with SRFI-19
Gordon Weakliem <[email protected]>
| Newsgroups | gmane.lisp.scheme.plt.schematics |
|---|---|
| Message-ID | <8881836.1091767607488.JavaMail.www-data@c007> |
This may be a fairly evil thing to be doing in the first place, but I've been doing date arithmetic using SRFI-19 like so:
(require (prefix time: ("19.ss" "srfi")))
(define date-add-days
(lambda (dt n)
(time:julian-day->date (+ n (time:date->julian-day dt)) 0)))
Now, I can do something like the following:
> (define next-dt (time:current-date))
> (time:date->string next-dt)
"Thu Aug 05 22:24:58-0600 2004"
; I'm expecting to get something like "Sun Aug 08 22:24:58-0600 2004"
> (set! next-dt (date-add-days next-dt 3))
* remainder: expects type <integer> as 1st argument, given: 9827308833624167200/9; other arguments were: 1000000000
The thing is, this works using the 1.3 SRFI release, somehow, but when I got a new version of SRFI from CVS this now is broken. Any suggestions on what the right way to do this would be?
--
Gordon Weakliem
http://www.eighty-twenty.net
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com