From d79a8d252cd9e605fb6cb96cf05a40b59b3a3975 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 12 Jan 2025 22:41:30 +0100 Subject: [PATCH] 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. (cherry picked from commit ccd927d741df928d4de578dffac74bc67d24c8b0) --- src/timefns.c | 2 +- test/src/timefns-tests.el | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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. */) /* No local time zone name is available; use numeric zone instead. */ long int hour = offset / 3600; int min_sec = offset % 3600; - int amin_sec = min_sec < 0 ? - min_sec : min_sec; + int amin_sec = eabs (min_sec); int min = amin_sec / 60; int sec = amin_sec % 60; 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." (should (time-equal-p time- (time-convert time- form))) (should (time-equal-p time+ (time-convert time+ form)))))))) +(ert-deftest current-time-zone () + (should (listp (current-time-zone))) + (should (= (length (current-time-zone)) 2))) + ;;; timefns-tests.el ends here -- 2.39.5