emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/triples 628e6b5772 2/3: Fix obsolete timestamp message


From: ELPA Syncer
Subject: [elpa] externals/triples 628e6b5772 2/3: Fix obsolete timestamp message in some instances of emacs 28
Date: Wed, 1 Mar 2023 20:58:37 -0500 (EST)

branch: externals/triples
commit 628e6b5772ace5f452b312a249d17832adc53a26
Author: Andrew Hyatt <ahyatt@gmail.com>
Commit: Andrew Hyatt <ahyatt@gmail.com>

    Fix obsolete timestamp message in some instances of emacs 28
    
    The issue was that we were incorrectly calling `time-convert' on numbers 
that
    wer already the last second, which resulted in a format that 
`time-substract'
    found invalid.  It's unclear exactly what was going wrong, but switching to
    floats completely solves the problem.
    
    Fixes https://github.com/ahyatt/ekg/issues/16
---
 NEWS.org           | 1 +
 triples-backups.el | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 0a224696e3..3bbaa1723a 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -2,6 +2,7 @@ TITLE: Changelog for the triples module for GNU Emacs.
 
 * 0.2.6
 - Fix bug where the functions =triples-subjects-with-predicate-object= could 
return the same subject multiple times.
+- Fix bug where backups were causing messages about "obsolete timestamp" for 
some users on Emacs 28.2.
 * 0.2.5
 - Fix bug where backing up a =nil= filename resulted in an error.
 - Fix bug where strings are wrongly escapified, distoring text especially when 
repeatedly saved.
diff --git a/triples-backups.el b/triples-backups.el
index 28299fb42e..df5ee8d48e 100644
--- a/triples-backups.el
+++ b/triples-backups.el
@@ -61,11 +61,11 @@ default to the standard triple database given in
     (unless (fboundp strategy-func)
       (display-warning
        'triples
-       (format "Triples backup strategy %s not found, defaulting to 
`triples-backups-strategy-daily'" 
+       (format "Triples backup strategy %s not found, defaulting to 
`triples-backups-strategy-daily'"
                strategy-func)
        :error))
     (when (funcall (or (symbol-function strategy-func) 
#'triples-backups-strategy-daily)
-                   (time-convert (plist-get backup-info :last-update-time) t))
+                   (plist-get backup-info :last-update-time))
       (triples-backup db filename (plist-get backup-info :num-to-keep))
       (apply #'triples-set-type db 'database 'backup (plist-put backup-info 
:last-update-time (time-convert (current-time) 'integer))))))
 
@@ -80,15 +80,14 @@ default to the standard triple database given in
 (defun triples-backups-strategy-daily (last-update)
   "Backup strategy to create a change daily at most.
 LAST-UPDATE is the time of the last update."
-  (>= (/ (time-convert (time-subtract (current-time) last-update) 'integer) 
86400)
+  (>= (/ (- (float-time (current-time)) (float-time last-update)) 86400)
       1))
 
 (defun triples-backups-strategy-weekly (last-update)
   "Backup strategy to create a change daily at most.
 LAST-UPDATE is the time of the last update."
-  (>= (/ (time-convert (time-subtract (current-time) last-update) 'integer) 
86400)
+  (>= (/ (- (float-time (current-time)) (float-time last-update)) 86400)
       7))
 
 (provide 'triples-backups)
 ;;; Code:
-



reply via email to

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