emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ccd927d741d 2/2: Use eabs in Fcurrent_time_zone


From: Stefan Kangas
Subject: master ccd927d741d 2/2: Use eabs in Fcurrent_time_zone
Date: Sun, 12 Jan 2025 19:06:10 -0500 (EST)

branch: master
commit ccd927d741df928d4de578dffac74bc67d24c8b0
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]