diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:31 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:31 -0800 |
commit | 5145dd3aa0c02c9fc496d1432fc4410674206e1d (patch) | |
tree | 540afc30c51da085f5bd8ec3f4c89f6496e7900d /cltime.scm | |
parent | 8466d8cfa486fb30d1755c4261b781135083787b (diff) | |
download | slib-5145dd3aa0c02c9fc496d1432fc4410674206e1d.tar.gz slib-5145dd3aa0c02c9fc496d1432fc4410674206e1d.zip |
Import Upstream version 3a2upstream/3a2
Diffstat (limited to 'cltime.scm')
-rw-r--r-- | cltime.scm | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -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))) |