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.
This commit is contained in:
Stefan Kangas 2025-01-12 22:41:30 +01:00
parent 85c73bb901
commit ccd927d741
2 changed files with 5 additions and 1 deletions

View file

@ -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;

View file

@ -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