]> git.eshelyaron.com Git - emacs.git/commitdiff
Workaround for faulty localtime() under macOS 10.6
authorCharles A. Roelli <charles@aurox.ch>
Sat, 30 Sep 2017 18:42:03 +0000 (20:42 +0200)
committerCharles A. Roelli <charles@aurox.ch>
Sun, 1 Oct 2017 17:07:22 +0000 (19:07 +0200)
* lisp/org/org-clock.el (org-clock--oldest-date): Only execute
'decode-time' on times later than year -2**31 under macOS 10.6.
See Bug#27706.

lisp/org/org-clock.el

index 8df185d2e910c28f1a84897ca796bb7d6576a22e..2eec817735a1266e6a914ee4cda58817652d04d4 100644 (file)
@@ -478,7 +478,17 @@ to add an effort property.")
          (funcall dichotomy
                   most-negative-fixnum
                   0
-                  (lambda (m) (ignore-errors (decode-time (list m 0))))))
+                  (lambda (m)
+                     ;; libc in macOS 10.6 hangs when decoding times
+                     ;; around year -2**31.  Limit `high' not to go
+                     ;; any earlier than that.
+                     (unless (and (eq system-type 'darwin)
+                                  (string-match-p
+                                   "10\\.6\\.[[:digit:]]"
+                                   (shell-command-to-string
+                                    "sw_vers -productVersion"))
+                                  (<= m -1034058203136))
+                       (ignore-errors (decode-time (list m 0)))))))
         (low
          (funcall dichotomy
                   most-negative-fixnum