Commit e7846630 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

First working public release:

* declare it to be under the MIT license
* include a bunch of macros and utilities from QUUX (have to be moved in their own package!)
parent 3ebd60de
Copyright (c) 2005-2009 ITA Software, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
From: =?ISO-8859-1?Q?Far=E9?= <fahree@[domain-name-of-msg-id-below].com>
Date: Mon, 26 Oct 2009 16:46:31 -0400
Message-ID: <653bea160910261346m43ca20e7tc93b4b9d1d491d34@mail.gmail.com>
Subject: itasoftware.com/quux/time
To: bigthingist@[domain-name-of-msg-id-above].com
Content-Type: multipart/mixed; boundary=0016e6d96d204135b60476dca966
This library was created by Matt Marjanovic at ITA Software as part of our QRes project.
--0016e6d96d204135b60476dca966
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
It is published as free software under an MIT-style license (see file LICENSE).
Good opportunity to publish some free software.
The official home page is
http://common-lisp.net/projects/qitab/
See also on cliki:
http://www.cliki.net/quux-time
Please make the initial commit with unmodified files, so we have an
easier time tracking changes you make.
Copyright and license are MIT style. You can override any proprietary
notice in a second commit, and copy the license from XCVB.
Note that it current initial state, it depends on some other utilities from QUUX:
defconstant-equal
defconstant-equalp
defun-inline
A copy of just those functions is available in macros.lisp, but eventually should be
imported from a library.
The README may or may not be useful. I let you judge how useful it is or is=
n't.
If you feel this software is no good for your purposes, just don't
bother publishing it.
Thanks!
[ Fran=E7ois-Ren=E9 =D0VB Rideau | Reflection&Cybernethics | http://fare.tu=
nes.org ]
Also, the test suite depends on the QRes internal test suite tools, not yet published.
;;; -*- mode: lisp -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Free Software available under an MIT-style license. See LICENSE ;;;
;;; ;;;
;;; Copyright (c) 2005-2009 ITA Software, Inc. All rights reserved. ;;;
;;; ;;;
;;; Original author: Matt Marjanovic ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+xcvb
(module
(:fullname "/quux/time"
:author ("Matt Marjanovic")
:maintainer "Francois-Rene Rideau"
:licence "MIT" ;; MIT-style license. See LICENSE
:description "Library to deal with representation of time"
:depends-on ("time")
:supersedes-asdf ("quux-time")))
This diff is collapsed.
#+xcvb (module (:description "package for QUUX time"))
(cl:defpackage :quux-time
(:use :common-lisp) ;; :alexandria ? quux-macros?
(:shadow
#:decode-universal-time
#:encode-universal-time)
(:export
:integer-date
:integer-tofd
:integer-time
:integer-duration
;; XXX... insert here a list of everything exported...
))
;;; -*- mode: lisp -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Free Software available under an MIT-style license. See LICENSE ;;;
;;; ;;;
;;; Copyright (c) 2005-2009 ITA Software, Inc. All rights reserved. ;;;
;;; ;;;
;;; Original author: Matt Marjanovic ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :asdf)
(defsystem :quux-time
:depends-on ()
:components
((:file "pkgdcl")
(:file "macros" :depends-on ("pkgdcl"))
(:file "time" :depends-on ("macros"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Confidential and proprietary information of ITA Software, Inc. ;;;
;;; Free Software under MIT-Style license. See file LICENSE. ;;;
;;; ;;;
;;; Copyright (c) 2006 ITA Software, Inc. All rights reserved. ;;;
;;; ;;;
......@@ -10,6 +10,8 @@
;; This module provides xUnit tests for rigged & cached clocks
#+xcvb (module (:depends-on ("time" (:build "/quux/test"))))
(in-package :quux-test)
(defun showtime (time &optional (message ""))
......
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Confidential and proprietary information of ITA Software, Inc. ;;;
;;; Free Software under MIT-Style license. See file LICENSE. ;;;
;;; ;;;
;;; Copyright (c) 2005-2008 ITA Software, Inc. All rights reserved. ;;;
;;; ;;;
......@@ -8,7 +8,9 @@
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package "QUUX")
#+xcvb (module (:depends-on ("macros")))
(in-package :quux-time)
;;; Date and time functions
......@@ -35,7 +37,7 @@
(eval-when (:compile-toplevel :load-toplevel :execute)
(defconstant-equal +400-years-of-seconds+
(defconstant-equal +400-years-of-seconds+
(- (cl:encode-universal-time 0 0 0 1 4 (+ 400 2010) 0)
(cl:encode-universal-time 0 0 0 1 4 2010 0))
"The number of seconds in four hundred years")
......@@ -120,7 +122,7 @@
(defun roll-time (time &key (seconds 0)
(minutes 0)
(hours 0)
(days 0)
(days 0)
(months 0)
(years 0))
"Return an integer-time before/after TIME by SECONDS, MINUTES,
......@@ -219,7 +221,7 @@ varies. Therefore it does not always hold that:
(defmethod print-object ((zul zoned-time) stream)
"Pretty-print a zoned-time object."
(print-unprintable-object (zul stream :type t :identity t)
(print-unreadable-object (zul stream :type t :identity t)
(write-zoned-time zul stream
:date-as :yyyy-mm-dd :time-as :hh-mm-ss
:show-timezone t)))
......@@ -297,7 +299,7 @@ varies. Therefore it does not always hold that:
:utc (local-date-only (utc-time z))))
;;---!!!mm WHO ADDED THIS?? IT IS BROKEN.
;;---!!!mm WHO ADDED THIS?? IT IS BROKEN.
(defmethod add-days ((z zoned-time) days)
"Add some number of days to a zoned-time."
(if (zerop days)
......@@ -505,8 +507,7 @@ varies. Therefore it does not always hold that:
(eval-when (:compile-toplevel :load-toplevel :execute)
(defconstant-equalp $days-until-year-month
(let ((v (make-array (i* 13 (i+ 1 (i- $it-cache-last-year
$it-cache-first-year))))))
(let ((v (make-array (i* 13 (1+ (- $it-cache-last-year $it-cache-first-year))))))
(do ((year $it-cache-first-year (1+ year)))
((> year $it-cache-last-year) v)
(declare (type fixnum year))
......@@ -1521,7 +1522,7 @@ varies. Therefore it does not always hold that:
in the range 1970 to 2069 [default].
The function returns a local datetime as an integer-time, or NIL."
(check-types (string string)
(fixnum start end))
(multiple-value-bind (seconds minutes hours day month year)
......@@ -1614,7 +1615,7 @@ varies. Therefore it does not always hold that:
in the range 1970 to 2069 [default].
The function returns a local date represented as an integer-time, or NIL."
(let ((time (parse-local-time string :start start :end end
:guess-year guess-year
:guess-year-offset guess-year-offset
......@@ -2095,12 +2096,12 @@ varies. Therefore it does not always hold that:
:show-weekday show-weekday
:use-uppercase use-uppercase)))
(defun local-date-to-string-format (date format)
(defun local-date-to-string-format (date format)
"Return the given local integer-date DATE as formatted string according to the FORMAT,
SHOW-WEEKDAY and USE-UPPERCASE arguments as expected by WRITE-EXPLODED-DATE."
(check-types (integer-time date))
(with-output-to-string (stream)
(write-local-date date stream
(write-local-date date stream
:format format :show-weekday nil :use-uppercase t)))
(defun local-date-to-iso8601-string (date)
......@@ -2116,7 +2117,7 @@ varies. Therefore it does not always hold that:
:DATE-ONLY -> DDMTHYYY
:BRIEF -> DD-MTH-YYYY HH:MM
any of (:DDMTH :DDMTHYY :DDMTHYYYY :DD-MTH-YYYY :DDMMYY
any of (:DDMTH :DDMTHYY :DDMTHYYYY :DD-MTH-YYYY :DDMMYY
:MMDDYY :DDMMYYYY :MMDDYYYY :YYYYMMDD :YYYYMM :YYMMDD :YYYY-MM-DD)
-> whatever WRITE-LOCAL-DATE produces for that format specification.
For all other values of FORMAT, YYYY-MM-DD HH:MM:SS is produced."
......@@ -2137,8 +2138,8 @@ varies. Therefore it does not always hold that:
(write-local-tofd date stream :format :hh-mm))
;;---*** DLD: Shouldn't this take all the formats WRITE-LOCAL-DATE takes?
;;---*** msalib: why yes, yes it should
((:ddmth :ddmthyy :ddmthyyyy :dd-mth-yyyy :ddmmyy
:mmddyy :ddmmyyyy :mmddyyyy
((:ddmth :ddmthyy :ddmthyyyy :dd-mth-yyyy :ddmmyy
:mmddyy :ddmmyyyy :mmddyyyy
:yyyymmdd :yyyymm :yymmdd :yyyy-mm-dd)
(write-local-date date stream
:format format
......@@ -2166,7 +2167,7 @@ varies. Therefore it does not always hold that:
(let ((offset (local-date-offset (local-time time1-zul) (local-time time2-zul))))
(cond ((izerop offset) nil)
(t offset))))
(defun date-change-indicator (time1-zul time2-zul)
"Return a ``date change'' indicator that describes how many days are between
TIME1-ZUL and TIME2-ZUL. If they are on the same date, \" \" is returned,
......@@ -2240,7 +2241,7 @@ write-date defaults: :dd-mmm-yyyy
prefixed by a colon in the format specification (e.g. ~:/utc%ISO8601/),
uppercase letters are used. UTC may be either an integer-time or a
zoned-time, but it is always printed as UTC time."
(declare (ignore at-sign-p))
(check-types ((or integer-time zoned-time) utc))
(etypecase utc
......@@ -2281,7 +2282,7 @@ write-date defaults: :dd-mmm-yyyy
(defun cl-user::zul%ISO8601 (stream zul colon-p at-sign-p)
(declare (ignore at-sign-p))
(check-types (zoned-time zul))
(write-zoned-time zul stream :date-as :iso8601 :use-uppercase (not colon-p)))
(defun cl-user::loc%DDMTH (stream date colon-p at-sign-p)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment