[go: up one dir, main page]

File: constants.lisp

package info (click to toggle)
cl-local-time 1.1.6-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 188 kB
  • ctags: 203
  • sloc: lisp: 1,374; sh: 89; makefile: 75
file content (69 lines) | stat: -rw-r--r-- 1,971 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
;;; -*- Mode: Lisp -*-
;;; $Id: constants.lisp,v 1.4 2001/11/12 19:48:20 jesse Exp $
;;;
;;; Copyright (c) 2000, 2001 onShore Development, Inc.
;;;
;;; constants and variables

(in-package :local-time)

(defconstant +seconds/minute+ 60
  "number of seconds in a minute")
(defconstant +minutes/hour+ 60
  "number of minutes in an hour")
(defconstant +seconds/hour+ (* +seconds/minute+ +minutes/hour+)
  "number of seconds in an hour")
(defconstant +seconds/day+ (* +seconds/hour+ 24)
  "number of seconds in a day")
(defconstant +msecs/day+ (* +seconds/day+ 1000)
  "number of milliseconds in a day")

(defparameter *system-timezone* nil
  "holds the default timezone for all time operations needing a default")

(defparameter *default-timezone* nil
  "holds the default timezone for all time operations needing a default")

(defparameter *UTC* nil)

(defparameter *local-time-universal-epoch*
  (encode-universal-time 0 0 0 1 3 2000))

(defconstant +days-in-year+ 365)

;; Months

(defvar *month-keywords*
  '(:january :february :march :april :may :june :july :august :september
    :october :november :december))

(defvar *month-names*
  '("January" "February" "March" "April" "May" "June" "July" "August"
    "September" "October" "November" "December"))

(defun month-name (month-index)
  (nth month-index *month-names*))

(defun ordinal-month (month-keyword)
  "Return the zero-based month number for the given MONTH keyword."
  (position month-keyword *month-keywords*))

;; Days

(defvar *day-keywords*
  '(:sunday :monday :tuesday :wednesday :thursday :friday :saturday))

(defvar *day-names*
  '("Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"))

(defun day-name (day-index)
  (nth day-index *day-names*))

(defun ordinal-day (day-keyword)
  "Return the zero-based day number for the given DAY keyword."
  (position day-keyword *day-keywords*))

;; Timezones

(defvar *timezones* (make-hash-table :test #'equal)
  "Timezones hashed by ID")