[local-time-devel] proper way to "travel in time"(?)

Attila Lendvai attila.lendvai at gmail.com
Mon Sep 24 09:07:44 UTC 2007


> I've got one more question: is there any way to find shift the
> local-time by minute/hour/day/month/year back and forth so that the
> number of days in month and in year are taken into account
> automatically? I see there is a function named "local-time-sum" but I do
> not think it will do what I need. For instance, its results will be
> weird if I try to shift the time stamp by one month.

i think you should use decode/encode-local-time for this:

(encode-local-time 0 0 0 0 40 01 2000) => @2000-02-09T00:00:00+01:00

so, overflowing on the values is handled gracefully. this behaviour as
an API is arguable, but this is how it works now. maybe we should
eventually add a keyword arg to encode-local-time that tells whether
to allow it or not...

there's also local-time-adjust-days, it's basically what you need for
days. the rest is implementable using encode/decode-local-time.

-- 
 attila



More information about the local-time-devel mailing list