unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
@ 2017-10-21  3:04 Paul Eggert
  2017-10-21  7:19 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Eggert @ 2017-10-21  3:04 UTC (permalink / raw)
  To: 28921, mvoteiza; +Cc: Paul Eggert

* lisp/xdg.el (xdg-thumb-mtime): Return an Emacs timestamp,
not an integer.  This avoids signaling an error on 32-bit
Emacs, where timestamps typically do not fit into fixnums.
---
 lisp/xdg.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/xdg.el b/lisp/xdg.el
index 76106f4258..6dcef74e4e 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -93,8 +93,8 @@ xdg-thumb-name
   (concat (md5 (xdg-thumb-uri filename)) ".png"))
 
 (defun xdg-thumb-mtime (filename)
-  "Return modification time of FILENAME as integral seconds from the epoch."
-  (floor (float-time (nth 5 (file-attributes filename)))))
+  "Return modification time of FILENAME as an Emacs timestamp."
+  (nth 5 (file-attributes filename)))
 
 \f
 ;; XDG User Directories
-- 
2.13.6






^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
  2017-10-21  3:04 bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs Paul Eggert
@ 2017-10-21  7:19 ` Eli Zaretskii
  2017-10-21  9:11 ` Tino Calancha
  2017-10-21 14:26 ` Mark Oteiza
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2017-10-21  7:19 UTC (permalink / raw)
  To: Paul Eggert; +Cc: mvoteiza, 28921

> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Fri, 20 Oct 2017 20:04:55 -0700
> Cc: Paul Eggert <eggert@cs.ucla.edu>
> 
> * lisp/xdg.el (xdg-thumb-mtime): Return an Emacs timestamp,
> not an integer.  This avoids signaling an error on 32-bit
> Emacs, where timestamps typically do not fit into fixnums.

Fine with me for the release branch.

Thanks.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
  2017-10-21  3:04 bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs Paul Eggert
  2017-10-21  7:19 ` Eli Zaretskii
@ 2017-10-21  9:11 ` Tino Calancha
  2017-10-22  7:41   ` Paul Eggert
  2017-10-21 14:26 ` Mark Oteiza
  2 siblings, 1 reply; 5+ messages in thread
From: Tino Calancha @ 2017-10-21  9:11 UTC (permalink / raw)
  To: Paul Eggert; +Cc: mvoteiza, 28921

Paul Eggert <eggert@cs.ucla.edu> writes:

>  (defun xdg-thumb-mtime (filename)
> -  "Return modification time of FILENAME as integral seconds from the epoch."
> -  (floor (float-time (nth 5 (file-attributes filename)))))
> +  "Return modification time of FILENAME as an Emacs timestamp."
> +  (nth 5 (file-attributes filename)))
Maybe you could use here the new accesor `file-attribute-modification-time':

diff --git a/lisp/xdg.el b/lisp/xdg.el
index 4250faaeb4..9edc3d2629 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -94,8 +94,8 @@ xdg-thumb-name
   (concat (md5 (xdg-thumb-uri filename)) ".png"))
 
 (defun xdg-thumb-mtime (filename)
-  "Return modification time of FILENAME as integral seconds from the epoch."
-  (floor (float-time (nth 5 (file-attributes filename)))))
+  "Return modification time of FILENAME as an Emacs timestamp."
+  (file-attribute-modification-time (file-attributes filename)))
 
 \f
 ;; XDG User Directories





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
  2017-10-21  3:04 bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs Paul Eggert
  2017-10-21  7:19 ` Eli Zaretskii
  2017-10-21  9:11 ` Tino Calancha
@ 2017-10-21 14:26 ` Mark Oteiza
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Oteiza @ 2017-10-21 14:26 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 28921

On 20/10/17 at 08:04pm, Paul Eggert wrote:
> * lisp/xdg.el (xdg-thumb-mtime): Return an Emacs timestamp,
> not an integer.  This avoids signaling an error on 32-bit
> Emacs, where timestamps typically do not fit into fixnums.

I had the following sitting in my tree, but I don't feel strongly either
way.

diff --git a/lisp/xdg.el b/lisp/xdg.el
index 76106f4258..f57ed5e683 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -93,8 +93,8 @@ xdg-thumb-name
   (concat (md5 (xdg-thumb-uri filename)) ".png"))
 
 (defun xdg-thumb-mtime (filename)
-  "Return modification time of FILENAME as integral seconds from the epoch."
-  (floor (float-time (nth 5 (file-attributes filename)))))
+  "Return modification time of FILENAME as seconds from the epoch."
+  (ffloor (float-time (nth 5 (file-attributes filename)))))
 
 \f
 ;; XDG User Directories





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs
  2017-10-21  9:11 ` Tino Calancha
@ 2017-10-22  7:41   ` Paul Eggert
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Eggert @ 2017-10-22  7:41 UTC (permalink / raw)
  To: Tino Calancha; +Cc: mvoteiza, 28921-done

Tino Calancha wrote:
> Maybe you could use here the new accesor `file-attribute-modification-time':

Thanks, good idea, I installed it that way into emacs-26. I prefer this to 
float-time because float-time loses information on platforms like GNU/Linux 
where typical file timestamps these days have about 61 bits of precision, which 
is more than the 53 bits that Emacs floats have.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-22  7:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-21  3:04 bug#28921: [PROPOSED] Fix xdg timestamp error on 32-bit Emacs Paul Eggert
2017-10-21  7:19 ` Eli Zaretskii
2017-10-21  9:11 ` Tino Calancha
2017-10-22  7:41   ` Paul Eggert
2017-10-21 14:26 ` Mark Oteiza

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

	https://git.savannah.gnu.org/cgit/emacs.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).