]> git.eshelyaron.com Git - emacs.git/commitdiff
Use eabs in Fcurrent_time_zone
authorStefan Kangas <stefankangas@gmail.com>
Sun, 12 Jan 2025 21:41:30 +0000 (22:41 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 13 Jan 2025 07:44:00 +0000 (08:44 +0100)
* 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
test/src/timefns-tests.el

index e2b393886066d6f9d5eb24b1dc1c1bfbe129c149..4fb142f2f1bcdc4caa5adfc0d381e46659518c5f 100644 (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;
index 3e75a3f9b63b6e8c44ab307e29e528843fd3644b..89a199f37fce5ae4ebbd6596d42c1b40c5121e19 100644 (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