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

Denys Rtveliashvili rtvd at mail.ru
Mon Oct 1 12:35:35 UTC 2007


I have written a function which returns a local-time object with a time, 
shifted from the specified one by a necessary offset.
It is possible to call it like this:

(adjusted-local-time :day 15 (now))

(adjusted-local-time :month -1 *important-date*)

When shifting usec/sec/../days it works with the local-time object 
directly (as there can be no overflows).
The only exceptions are shifts by months and years. In such cases the 
time stamp is decomposed by decode-local-time and then it is shifted. 
However, before the date is finally composed with the encode-local-time 
an additional test is made: the day of month should be not larger than 
the number of days in that month. If it is larger, the day of month is 
set to the last one available.

Any comments are welcome.

Please find a patch attached to this email.

With kind regards,
Denys Rtveliashvili

>
>     I am going to try doing something like that myself and if the
>     result is
>     nice I will send it to this maillist. 
>
>
> sounds good, looking forward to it!
>
> -- 
> attila 




More information about the local-time-devel mailing list