local-time
local-time is a library for manipulating date and time information in a semi-standard manner. It is based almost entirely off of Erik Naggum's paper, The Long, Painful History of Time. It includes such features as:

  • Time and date arithmetic
  • ISO 8601 timestring formatted output and parsing
  • Reader macros to embed timestrings directly in code
  • Timezone handling (will read unix tzfile format)
  • Conversion between universal and unix time epochs
  • Julian date calculation

The library has been tested under sbcl 1.0.25.12 on Linux x86 and Linux x86_64. It requires cl-fad for operation, and has been placed under the BSD license.

This library is still under development. Contributors and feedback are both very welcome. The maintainer of this project is Daniel Lowe. The last update was 1.0.1 on 2009-03-12.


Sometimes local-time runs in an endless loop (seen with sbcl and ccl when using timestamp+). There was also such a report on the mailing list with a patch. But this patch doesn't solve all problems. I added a log message near the comment
;; We hit the DST boundary. We need to restart again
;; with :sec, but this time we know both old and new
;; UTC offset will be the same, so it's safe to do
and it loops here. Maybe
(= old-utc-offset new-utc-offset)
compares two float, which doesn't work always as you know. -- cb


The main website may be found at http://www.common-lisp.net/project/local-time/.

ASDF-install package (obsolete) http://www.common-lisp.net/project/local-time/local-time-1.0.1.tar.gz


easily installable using Quicklisp as follows:
CL-USER> (ql:quickload 'local-time)

To load "local-time":                                                                                                                                                                 
  Load 1 ASDF system:                                                                                                                                                                 
    local-time                                                                                                                                                                        
; Loading "local-time"                                                                                                                                                                
                                                                                                                                                                                      
(LOCAL-TIME)  

CL-USER> ;;;following is an example of #:local-time using a function call to interact with its timestamp structure object.

; No Value

CL-USER> (local-time:timestamp-year (local-time:now))


2013
Official documentation / API manual (as HTML) at common-lisp.net/project/local-time/manual.html