1 | ;;;; srfi-19-common.scm -*- Scheme -*- |
---|
2 | |
---|
3 | ;; -- Miscellaneous Constants. |
---|
4 | |
---|
5 | (define-constant MS/NS 1000000) |
---|
6 | (define-constant MuS/NS 1000) |
---|
7 | |
---|
8 | (define-constant MS/S 1000) |
---|
9 | (define-constant MuS/S 1000000) |
---|
10 | (define-constant NS/S 1000000000) |
---|
11 | (define-constant -NS/S -1000000000) |
---|
12 | |
---|
13 | (define-constant SEC/YR 31536000) ; seconds in a year |
---|
14 | (define-constant SEC/DY 86400) ; seconds in a day |
---|
15 | (define-constant SEC/DY/2 43200) ; seconds in a half day |
---|
16 | (define-constant SEC/HR 3600) |
---|
17 | (define-constant SEC/MIN 60) |
---|
18 | |
---|
19 | #;(define-constant iNS/S 1000000000.0) |
---|
20 | #;(define-constant iSEC/DY 86400.0) |
---|
21 | #;(define-constant iONE-HALF 0.5) |
---|
22 | |
---|
23 | (define-constant HR/DY 24) |
---|
24 | |
---|
25 | (define-constant DY/WK 7) |
---|
26 | (define-constant DY/MN 31) ;maximum days per month |
---|
27 | (define-constant DY/YR 365) ;normal days per year |
---|
28 | |
---|
29 | (define-constant MN/YR 12) ;months per year |
---|
30 | |
---|
31 | ;; |
---|
32 | |
---|
33 | ;MUST be a constant! |
---|
34 | |
---|
35 | (define-constant *date-tag* 'srfi-19#date) |
---|
36 | (define-constant *time-tag* 'srfi-19#time) |
---|
37 | |
---|
38 | (define-constant *date-timezone-info-tag* 'srfi-19#date-timezone-info) |
---|
39 | |
---|
40 | (define-constant *time-period-tag* 'srfi-19#time-period) |
---|
41 | |
---|
42 | ;; misc-utils |
---|
43 | |
---|
44 | (define-inline (->boolean obj) (and obj #t)) |
---|
45 | |
---|
46 | (define-inline (true? obj) (and obj (boolean? obj))) |
---|
47 | ;(define false? not?) |
---|
48 | |
---|
49 | ;; fx-utils |
---|
50 | |
---|
51 | (define-inline (fxabs x) (if (fx< x 0) (fxneg x) x)) |
---|
52 | |
---|
53 | (define-inline (fxzero? x) (fx= 0 x)) |
---|