emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: bug#27736: OSX 10.6.8: Building from master branch fails.
       [not found]     ` <ef99767e-50b8-0740-17c9-c93f12f6a79e@cs.ucla.edu>
@ 2018-03-28 22:08       ` Paul Eggert
  0 siblings, 0 replies; only message in thread
From: Paul Eggert @ 2018-03-28 22:08 UTC (permalink / raw)
  To: Glenn Morris
  Cc: 27736, Keith David Bershatsky, Charles A. Roelli, emacs-org list,
	Noam Postavsky

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

On 03/28/2018 12:33 PM, Paul Eggert wrote:
> Unfortunately the new org code contains the expression (encode-time 0 
> 0 0 0 0 -50000), which won't work on Emacs platforms where time_t is 
> 32 bits or is unsigned, since such platforms cannot represent a time_t 
> value corresponding to the year -50000. 

I installed the attached patch into Emacs master to try to fix this. 
I'll CC: this to emacs-orgmode in the hopes that this won't get lost in 
the next merge to Emacs master.


[-- Attachment #2: 0001-Port-recent-org-clock-fix-to-POSIX-time_t.patch --]
[-- Type: text/x-patch, Size: 1751 bytes --]

From 43994e484fadac28682542e75548e80cbb80987d Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 28 Mar 2018 15:03:40 -0700
Subject: [PATCH] Port recent org-clock fix to POSIX time_t

* lisp/org/org-clock.el (org-clock-special-range):
Don't assume support for time_t values less than 0, or less than
-2**31 for that matter (Bug#27736).
---
 lisp/org/org-clock.el | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index ff32e28d1e..9be0d5bc1f 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -2239,8 +2239,18 @@ org-clock-special-range
     (let* ((start (pcase key
 		    (`interactive (org-read-date nil t nil "Range start? "))
                     ;; In theory, all clocks started after the dawn of
-                    ;; humanity.
-		    (`untilnow (encode-time 0 0 0 0 0 -50000))
+                    ;; humanity.  However, the platform's clock
+                    ;; support might not go back that far.  Choose the
+                    ;; POSIX timestamp -2**41 (approximately 68,000
+                    ;; BCE) if that works, otherwise -2**31 (1901) if
+                    ;; that works, otherwise 0 (1970).  Going back
+                    ;; billions of years would loop forever on Mac OS
+                    ;; X 10.6 with Emacs 26 and earlier (Bug#27736).
+		    (`untilnow
+                     (let ((old 0))
+                       (dolist (older '((-32768 0) (-33554432 0)) old)
+                         (when (ignore-errors (decode-time older))
+			   (setq old older)))))
 		    (_ (encode-time 0 m h d month y))))
 	   (end (pcase key
 		  (`interactive (org-read-date nil t nil "Range end? "))
-- 
2.14.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-28 22:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <m2a8432iso.wl%esq@lawlist.com>
     [not found] ` <46d25462-4eb0-0bd0-f5ab-2b28bae98ee6@cs.ucla.edu>
     [not found]   ` <exo9j8f7ff.fsf@fencepost.gnu.org>
     [not found]     ` <ef99767e-50b8-0740-17c9-c93f12f6a79e@cs.ucla.edu>
2018-03-28 22:08       ` bug#27736: OSX 10.6.8: Building from master branch fails Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).