summaryrefslogtreecommitdiffstats
path: root/cltime.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:31 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:31 -0800
commit5145dd3aa0c02c9fc496d1432fc4410674206e1d (patch)
tree540afc30c51da085f5bd8ec3f4c89f6496e7900d /cltime.scm
parent8466d8cfa486fb30d1755c4261b781135083787b (diff)
downloadslib-5145dd3aa0c02c9fc496d1432fc4410674206e1d.tar.gz
slib-5145dd3aa0c02c9fc496d1432fc4410674206e1d.zip
Import Upstream version 3a2upstream/3a2
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)))