diff options
| author | Stefan Kangas | 2025-01-12 22:41:30 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2025-01-13 01:05:42 +0100 |
| commit | ccd927d741df928d4de578dffac74bc67d24c8b0 (patch) | |
| tree | d19e12f45d8903c2f4bcbe82124073257c231fc6 | |
| parent | 85c73bb901e2adbad78e19c9a4f4d1ef74ac3d6d (diff) | |
| download | emacs-ccd927d741df928d4de578dffac74bc67d24c8b0.tar.gz emacs-ccd927d741df928d4de578dffac74bc67d24c8b0.zip | |
Use eabs in Fcurrent_time_zone
* src/timefns.c (Fcurrent_time_zone): Use eabs.
* test/src/timefns-tests.el
(timefns-tests-current-time-zone): New test.
| -rw-r--r-- | src/timefns.c | 2 | ||||
| -rw-r--r-- | test/src/timefns-tests.el | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/timefns.c b/src/timefns.c index e2b39388606..4fb142f2f1b 100644 --- a/src/timefns.c +++ b/src/timefns.c | |||
| @@ -1950,7 +1950,7 @@ the data it can't find. */) | |||
| 1950 | /* No local time zone name is available; use numeric zone instead. */ | 1950 | /* No local time zone name is available; use numeric zone instead. */ |
| 1951 | long int hour = offset / 3600; | 1951 | long int hour = offset / 3600; |
| 1952 | int min_sec = offset % 3600; | 1952 | int min_sec = offset % 3600; |
| 1953 | int amin_sec = min_sec < 0 ? - min_sec : min_sec; | 1953 | int amin_sec = eabs (min_sec); |
| 1954 | int min = amin_sec / 60; | 1954 | int min = amin_sec / 60; |
| 1955 | int sec = amin_sec % 60; | 1955 | int sec = amin_sec % 60; |
| 1956 | int min_prec = min_sec ? 2 : 0; | 1956 | int min_prec = min_sec ? 2 : 0; |
diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el index 3e75a3f9b63..89a199f37fc 100644 --- a/test/src/timefns-tests.el +++ b/test/src/timefns-tests.el | |||
| @@ -261,4 +261,8 @@ a fixed place on the right and are padded on the left." | |||
| 261 | (should (time-equal-p time- (time-convert time- form))) | 261 | (should (time-equal-p time- (time-convert time- form))) |
| 262 | (should (time-equal-p time+ (time-convert time+ form)))))))) | 262 | (should (time-equal-p time+ (time-convert time+ form)))))))) |
| 263 | 263 | ||
| 264 | (ert-deftest current-time-zone () | ||
| 265 | (should (listp (current-time-zone))) | ||
| 266 | (should (= (length (current-time-zone)) 2))) | ||
| 267 | |||
| 264 | ;;; timefns-tests.el ends here | 268 | ;;; timefns-tests.el ends here |