aboutsummaryrefslogtreecommitdiffstats
path: root/timezone.scm
diff options
context:
space:
mode:
authorDavid N. Welton <davidw@efn.org>1998-11-09 21:18:01 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commit926b1b647ac830660933a5e63eb52d4a2552e264 (patch)
treee25db5f6e1441d67f5d9af063432018ee20a5f51 /timezone.scm
parentb21cac3362022718634f7086964208b2eed8e897 (diff)
parentfa3f23105ddcf07c5900de47f19af43d1db1b597 (diff)
downloadslib-926b1b647ac830660933a5e63eb52d4a2552e264.tar.gz
slib-926b1b647ac830660933a5e63eb52d4a2552e264.zip
Import Debian changes 2c3-3debian/2c3-3
slib (2c3-3) frozen unstable; urgency=low * Fixes #16235. * Fixes #19943. * Fixes #20265. * Fixes #24917. * Fixes #27389. slib (2c3-2) frozen unstable; urgency=low * Re-uploaded for slink freeze. slib (2c3-1) unstable; urgency=low * New upstream release.
Diffstat (limited to 'timezone.scm')
-rw-r--r--timezone.scm34
1 files changed, 19 insertions, 15 deletions
diff --git a/timezone.scm b/timezone.scm
index 8daa8fb..2890c39 100644
--- a/timezone.scm
+++ b/timezone.scm
@@ -57,6 +57,25 @@
(define tz:default #f)
+;;; This definition is here so that READ-TZFILE can verify the
+;;; existence of these files before loading tzfile.scm to actually
+;;; read them.
+(define tzfile:vicinity (make-vicinity "/usr/lib/zoneinfo/"))
+
+(define (read-tzfile path)
+ (let ((realpath
+ (cond ((not path) (in-vicinity tzfile:vicinity "localtime"))
+ ((or (char-alphabetic? (string-ref path 0))
+ (char-numeric? (string-ref path 0)))
+ (in-vicinity tzfile:vicinity path))
+ (else path))))
+ (and (file-exists? realpath)
+ (let ((zone #f))
+ (require 'tzfile)
+ (set! zone (tzfile:read realpath))
+ (if zone (list->vector (cons 'tz:file zone))
+ (slib:error 'read-tzfile realpath))))))
+
;;; Parse Posix TZ string.
(define (string->transition-day-time str)
@@ -125,21 +144,6 @@
(vector 'tz:rule tz tzname dtzname offset doffset start end))))
(else #f))))
-(define (read-tzfile path)
- (require 'tzfile)
- (let ((realpath
- (cond ((not path) (in-vicinity tzfile:vicinity "localtime"))
- ((or (char-alphabetic? (string-ref path 0))
- (char-numeric? (string-ref path 0)))
- (in-vicinity tzfile:vicinity path))
- (else path))))
- (if (file-exists? realpath)
- (let ((zone (tzfile:read realpath)))
- (if zone (list->vector (cons 'tz:file zone))
- (slib:error 'read-tzfile realpath)))
- (slib:error 'read-tzfile "file not found:" realpath)
- )))
-
(define (time-zone tz)
(cond ((not tz) (read-tzfile #f))
((vector? tz) tz)