the same method as \"ls\" to decide whether to show time-of-day or
year, depending on distance between file date and NOW."
(let* ((time (nth (find-lisp-time-index switches) file-attr))
- (diff16 (- (car time) (car now)))
- (diff (+ (ash diff16 16) (- (car (cdr time)) (car (cdr now)))))
- (past-cutoff (- (* 6 30 24 60 60))) ; 6 30-day months
+ (diff (encode-time (time-subtract time now) 'integer))
+ (past-cutoff -15778476) ; 1/2 of a Gregorian year
(future-cutoff (* 60 60))) ; 1 hour
(format-time-string
- (if (and
- (<= past-cutoff diff) (<= diff future-cutoff)
- ;; Sanity check in case `diff' computation overflowed.
- (<= (1- (ash past-cutoff -16)) diff16)
- (<= diff16 (1+ (ash future-cutoff -16))))
+ (if (<= past-cutoff diff future-cutoff)
"%b %e %H:%M"
"%b %e %Y")
time)))
This function can be used in hooks like `gnus-select-group-hook'
or `gnus-group-catchup-group-hook'."
(when gnus-newsgroup-name
- (let ((time (current-time)))
- (setcdr (cdr time) nil)
+ (let ((time (encode-time nil 'integer)))
(gnus-group-set-parameter gnus-newsgroup-name 'timestamp time))))
(defsubst gnus-group-timestamp (group)
(defun gnus-group-timestamp-delta (group)
"Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
- (let* ((time (or (gnus-group-timestamp group)
- (list 0 0)))
+ ;; FIXME: This should return a Lisp integer, not a Lisp float,
+ ;; since it is always an integer.
+ (let* ((time (or (gnus-group-timestamp group) 0))
(delta (time-subtract nil time)))
- (+ (* (nth 0 delta) 65536.0)
- (nth 1 delta))))
+ (float-time delta)))
(defun gnus-group-timestamp-string (group)
"Return a string of the timestamp for GROUP."
(defun gnus-icalendar-show-org-agenda (event)
(let* ((time-delta (time-subtract (gnus-icalendar-event:end-time event)
(gnus-icalendar-event:start-time event)))
- (duration-days (1+ (/ (+ (* (car time-delta) (expt 2 16))
- (cadr time-delta))
- 86400))))
-
+ (duration-days (1+ (floor (encode-time time-delta 'integer) 86400))))
(org-agenda-list nil (gnus-icalendar-event:start event) duration-days)))
(cl-defmethod gnus-icalendar-event:sync-to-org ((event gnus-icalendar-event-request) reply-status)
(unless (string-equal nnmaildir--delivery-time file)
(setq nnmaildir--delivery-time file
nnmaildir--delivery-count 0))
- (setq file (concat file "M" (number-to-string (caddr time))))
+ (setq file (concat file (format-time-string "M%6N" time)))
(setq file (concat file nnmaildir--delivery-pid)
file (concat file "Q" (number-to-string nnmaildir--delivery-count))
file (concat file "." (nnmaildir--system-name))
(defun nnmaildir-request-expire-articles (ranges &optional gname server force)
(let ((no-force (not force))
(group (nnmaildir--prepare server gname))
- pgname time boundary bound-iter high low target dir nlist
+ pgname time boundary high low target dir nlist
didnt nnmaildir--file nnmaildir-article-file-name
deactivate-mark)
(catch 'return
((null time)
(nnmaildir--expired-article group article))
((and no-force
- (progn
- (setq time (file-attribute-modification-time time)
- bound-iter boundary)
- (while (and bound-iter time
- (= (car bound-iter) (car time)))
- (setq bound-iter (cdr bound-iter)
- time (cdr time)))
- (and bound-iter time
- (car-less-than-car bound-iter time))))
+ (time-less-p boundary
+ (file-attribute-modification-time time)))
(setq didnt (cons (nnmaildir--art-num article) didnt)))
(t
(setq nnmaildir-article-file-name nnmaildir--file
(files (cdr (cdr (car l)))))
(and
(stringp dir)
- (consp time)
- (cond
- ((integerp (car time))
- (and (not (zerop (float-time time)))
- (ido-may-cache-directory dir)))
- ((eq (car time) 'ftp)
- (and (numberp (cdr time))
- (ido-is-ftp-directory dir)
- (ido-cache-ftp-valid (cdr time))))
- ((eq (car time) 'unc)
- (and (numberp (cdr time))
- (ido-is-unc-host dir)
- (ido-cache-unc-valid (cdr time))))
- (t nil))
+ (if (condition-case nil
+ (not (time-equal-p time 0))
+ (error))
+ (ido-may-cache-directory dir)
+ (and
+ (consp time)
+ (numberp (cdr time))
+ (cond
+ ((eq (car time) 'ftp)
+ (and (ido-is-ftp-directory dir)
+ (ido-cache-ftp-valid (cdr time))))
+ ((eq (car time) 'unc)
+ (and (ido-is-unc-host dir)
+ (ido-cache-unc-valid (cdr time)))))))
(let ((s files) (ok t))
(while s
(if (stringp (car s))
(ido-cache-unc-valid (cdr ctime)))))
(t
(if attr
- (setq valid (and (= (car ctime) (car mtime))
- (= (car (cdr ctime)) (car (cdr mtime))))))))
+ (setq valid (time-equal-p ctime mtime)))))
(unless valid
(setq ido-dir-file-cache (delq cached ido-dir-file-cache)
cached nil)))
(current-time)
time)))
(tramp-adb-send-command-and-check
- ;; Use shell arithmetic because of Emacs integer size limit.
- v (format "touch -t $(( %d * 65536 + %d )) %s"
- (car time) (cadr time)
+ v (format "touch -t %s %s"
+ (format-time-string "%Y%m%d%H%M.%S" time)
(tramp-shell-quote-argument localname))))))
(defun tramp-adb-handle-copy-file
;; (after Man-bgproc-sentinel-advice activate)
;; ;; Terminates man processing
;; "Report formatting time."
-;; (let* ((time (current-time))
-;; (time (+ (* (- (car time) (car WoMan-Man-start-time)) 65536)
-;; (- (cadr time) (cadr WoMan-Man-start-time)))))
-;; (message "Man formatting done in %d seconds" time)))
+;; (message "Man formatting done in %s seconds"
+;; (float-time (time-subtract nil WoMan-Man-start-time))))
\f
;;; Buffer handling: