summaryrefslogtreecommitdiffstats
path: root/cltime.scm
diff options
context:
space:
mode:
Diffstat (limited to 'cltime.scm')
-rw-r--r--cltime.scm22
1 files changed, 13 insertions, 9 deletions
diff --git a/cltime.scm b/cltime.scm
index 76d06d2..c271da2 100644
--- a/cltime.scm
+++ b/cltime.scm
@@ -18,10 +18,12 @@
;each case.
(require 'values)
+(require 'time-core)
(require 'time-zone)
-(require 'posix-time)
-(define time:1900 (time:invert time:gmtime '#(0 0 0 1 0 0 #f #f 0 0 "GMT")))
+(define time:1900 (time:invert
+ (lambda (tm) (time:split tm 0 0 "GMT")) ;time:gmtime
+ '#(0 0 0 1 0 0 #f #f 0 0 "GMT")))
;@
(define (get-decoded-time)
(decode-universal-time (get-universal-time)))
@@ -33,7 +35,7 @@
(let ((tv (apply time:split
(offset-time time:1900 utime)
(if (null? tzarg)
- (tz:params utime (tzset))
+ (tz:params utime (time-zone (getenv "TZ")))
(list 0 (* 3600 (car tzarg)) "???")))))
(values
(vector-ref tv 0) ;second [0..59]
@@ -50,10 +52,10 @@
)))
;@
(define (encode-universal-time second minute hour date month year . tzarg)
- (let* ((tz (if (null? tzarg)
- (tzset)
- (time-zone (string-append
- "???" (number->string (car tzarg))))))
+ (let* ((tz (time-zone
+ (if (null? tzarg)
+ (getenv "TZ")
+ (string-append "???" (number->string (car tzarg))))))
(tv (vector second
minute
hour
@@ -63,5 +65,7 @@
#f ;ignored
#f ;ignored
)))
- (difftime (time:invert localtime tv) time:1900)))
-
+ (difftime (time:invert
+ (lambda (tm) (apply time:split tm (tz:params tm tz))) ;localtime
+ tv)
+ time:1900)))