diff options
author | Paul Eggert <eggert@twinsun.com> | 1993-08-10 04:14:17 +0000 |
---|---|---|
committer | Paul Eggert <eggert@twinsun.com> | 1993-08-10 04:14:17 +0000 |
commit | 1c31a326f62153f39442142549b6566b05ce5b7b (patch) | |
tree | 8f99c0dd1f0e530988b6d9ca4bb0f6ec176700da /lisp | |
parent | d8bc2a71fd4d179122d1909b61b34867bfa546f0 (diff) | |
download | emacs-1c31a326f62153f39442142549b6566b05ce5b7b.tar.gz |
(timezone-fix-time, timezone-zone-to-minute): Simplify with `abs'
and `floor' functions instead of doing it ourselves.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/timezone.el | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lisp/timezone.el b/lisp/timezone.el index defd6451238..a461f734bfa 100644 --- a/lisp/timezone.el +++ b/lisp/timezone.el @@ -233,10 +233,7 @@ or an integer of the form +-HHMM, or a time zone name." (setq timezone (string-to-int timezone))) ;; Taking account of minute in timezone. ;; HHMM -> MM - ;;(+ (* 60 (/ timezone 100)) (% timezone 100)) - ;; ANSI C compliance about truncation of integer division - ;; by eggert@twinsun.com (Paul Eggert) - (let* ((abszone (max timezone (- timezone))) + (let* ((abszone (abs timezone)) (minutes (+ (* 60 (/ abszone 100)) (% abszone 100)))) (if (< timezone 0) (- minutes) minutes)))) (t 0))) @@ -293,12 +290,7 @@ If TIMEZONE is nil, use the local time zone." (diff (- (timezone-zone-to-minute timezone) (timezone-zone-to-minute local))) (minute (+ minute diff)) - (hour-fix - (if (< minute 0) - ;;(/ (- minute 59) 60) (/ minute 60) - ;; ANSI C compliance about truncation of integer division - ;; by eggert@twinsun.com (Paul Eggert) - (- (/ (- 59 minute) 60)) (/ minute 60)))) + (hour-fix (floor minute 60))) (setq hour (+ hour hour-fix)) (setq minute (- minute (* 60 hour-fix))) ;; HOUR may be larger than 24 or smaller than 0. |