From 9275fd16c8ec51702a63bfc3e8e736bb787b624c Mon Sep 17 00:00:00 2001
From: Anthony Cowley <acowley@gmail.com>
Date: Thu, 14 Jan 2016 18:13:45 -0500
Subject: [PATCH] lisp/ox-latex.el: PDF generation timestamp check

* lisp/ox-latex.el (org-latex-compile): Improve timestamp check on HFS+
  filesystem by only considering 1-second clock resolution.

Previously, the call to (current-time) could return a timestamp with
a non-zero microsecond or picosecond fields, while the file attribute
always has zeros for these fields. The check that the generated file is
newer than the reference timestamp only succeeded when the time to
generate the file crossed a 1-second clock interval.

TINYCHANGE
---
 lisp/ox-latex.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index a57677b..848fe3a 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3576,7 +3576,10 @@ Return PDF file name or an error if it couldn't be produced."
 	;; Check for process failure.  Provide collected errors if
 	;; possible.
 	(if (or (not (file-exists-p pdffile))
-		(time-less-p (nth 5 (file-attributes pdffile)) time))
+		;; Only compare times up to whole seconds as some filesystems
+		;; (e.g. HFS+) do not retain any finer granularity.
+		(time-less-p (org-sublist (nth 5 (file-attributes pdffile)) 1 2)
+			     (org-sublist time 1 2)))
 	    (error (format "PDF file %s wasn't produced" pdffile))
 	  ;; Else remove log files, when specified, and signal end of
 	  ;; process to user, along with any error encountered.
-- 
2.6.4

