Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code while we’re in the neighborhood. * lisp/battery.el (battery-linux-proc-acpi) (battery-linux-sysfs, battery-upower, battery-bsd-apm): * lisp/calendar/timeclock.el (timeclock-seconds-to-string) (timeclock-log, timeclock-last-period) (timeclock-entry-length, timeclock-entry-list-span) (timeclock-find-discrep, timeclock-generate-report): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/completion.el (cmpl-hours-since-origin): * lisp/ecomplete.el (ecomplete-decay-1): * lisp/emacs-lisp/ert.el (ert--results-update-stats-display) (ert--results-update-stats-display-maybe): * lisp/emacs-lisp/timer-list.el (list-timers): * lisp/emacs-lisp/timer.el (timer-until) (timer-event-handler): * lisp/erc/erc-backend.el (erc-server-send-ping) (erc-server-send-queue, erc-handle-parsed-server-response) (erc-handle-unknown-server-response): * lisp/erc/erc-track.el (erc-buffer-visible): * lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p) (erc-cmd-PING, erc-send-current-line): * lisp/eshell/em-pred.el (eshell-pred-file-time): * lisp/eshell/em-unix.el (eshell-show-elapsed-time): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp): * lisp/gnus/gnus-int.el (gnus-backend-trace): * lisp/gnus/gnus-sum.el (gnus-user-date): * lisp/gnus/mail-source.el (mail-source-delete-crash-box): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/ibuf-ext.el (ibuffer-mark-old-buffers): * lisp/gnus/nnmaildir.el (nnmaildir--scan): * lisp/mouse.el (mouse--down-1-maybe-follows-link) (mouse--click-1-maybe-follows-link): * lisp/mpc.el (mpc--faster-toggle): * lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE) (rcirc-sentinel): * lisp/net/tramp-cache.el (tramp-get-file-property): * lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p) (tramp-maybe-open-connection): * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): * lisp/org/org-clock.el (org-clock-resolve): (org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum): * lisp/org/org-timer.el (org-timer-start) (org-timer-pause-or-continue, org-timer-seconds): * lisp/org/org.el (org-evaluate-time-range): * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): * lisp/pixel-scroll.el (pixel-scroll-in-rush-p): * lisp/play/hanoi.el (hanoi-move-ring): * lisp/proced.el (proced-format-time): * lisp/progmodes/cpp.el (cpp-progress-message): * lisp/progmodes/flymake.el (flymake--handle-report): * lisp/progmodes/js.el (js--wait-for-matching-output): * lisp/subr.el (progress-reporter-do-update): * lisp/term/xterm.el (xterm--read-event-for-query): * lisp/time.el (display-time-update, emacs-uptime): * lisp/tooltip.el (tooltip-delay): * lisp/url/url-cookie.el (url-cookie-parse-file-netscape): * lisp/url/url-queue.el (url-queue-prune-old-entries): * lisp/url/url.el (url-retrieve-synchronously): * lisp/xt-mouse.el (xterm-mouse-event): Avoid double-rounding of time-related values. Simplify. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): When hoping for the best (unlikely), use a better decoded time. (icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time. * lisp/calendar/timeclock.el (timeclock-when-to-leave): * lisp/cedet/ede/detect.el (ede-detect-qtest): * lisp/desktop.el (desktop-create-buffer): * lisp/emacs-lisp/benchmark.el (benchmark-elapse): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nnmail.el (nnmail-expired-article-p): * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): * lisp/nxml/rng-maint.el (rng-time-function): * lisp/org/org-clock.el (org-clock-get-clocked-time) (org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle): * lisp/org/org-habit.el (org-habit-insert-consistency-graphs): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-fix-case-region-1): Use time-since instead of open-coding most of it. * lisp/erc/erc-dcc.el (erc-dcc-get-sentinel): * lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt): Now obsolete. All uses changed. (erc-time-diff): Accept all Lisp time values. All uses changed. * lisp/gnus/gnus-demon.el (gnus-demon-idle-since): * lisp/gnus/gnus-score.el (gnus-score-headers): * lisp/gnus/nneething.el (nneething-make-head): * lisp/gnus/nnheader.el (nnheader-message-maybe): * lisp/gnus/nnimap.el (nnimap-keepalive): * lisp/image.el (image-animate-timeout): * lisp/mail/feedmail.el (feedmail-rfc822-date): * lisp/net/imap.el (imap-wait-for-tag): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333): * lisp/obsolete/xesam.el (xesam-refresh-entry): * lisp/org/org-agenda.el (org-agenda-show-clocking-issues) (org-agenda-check-clock-gap, org-agenda-to-appt): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-resolve-clock) (org-clocktable-steps): * lisp/org/org-colview.el (org-columns-edit-value) (org-columns, org-agenda-columns): * lisp/org/org-duration.el (org-duration-from-minutes): * lisp/org/org-element.el (org-element-cache-sync-duration) (org-element-cache-sync-break) (org-element--cache-interrupt-p, org-element--cache-sync): * lisp/org/org-habit.el (org-habit-get-faces) * lisp/org/org-indent.el (org-indent-add-properties): * lisp/org/org-table.el (org-table-sum): * lisp/org/org-timer.el (org-timer-show-remaining-time) (org-timer-set-timer): * lisp/org/org.el (org-babel-load-file, org-today) (org-auto-repeat-maybe, org-2ft, org-time-stamp) (org-read-date-analyze, org-time-stamp-to-now) (org-small-year-to-year, org-goto-calendar): * lisp/org/ox.el (org-export-insert-default-template): * lisp/ses.el (ses--time-check): * lisp/type-break.el (type-break-time-warning) (type-break-statistics, type-break-demo-boring): * lisp/url/url-cache.el (url-cache-expired) (url-cache-prune-cache): * lisp/vc/vc-git.el (vc-git-stash-snapshot): * lisp/erc/erc-match.el (erc-log-matches-come-back): Simplify.
This commit is contained in:
parent
eba66c1eaf
commit
476066e89d
78 changed files with 338 additions and 395 deletions
|
@ -375,12 +375,12 @@ The following %-sequences are provided:
|
|||
last-full-capacity design-capacity))
|
||||
(and capacity rate
|
||||
(setq minutes (if (zerop rate) 0
|
||||
(floor (* (/ (float (if (string= charging-state
|
||||
"charging")
|
||||
(- full-capacity capacity)
|
||||
capacity))
|
||||
rate)
|
||||
60)))
|
||||
(floor (* (if (string= charging-state
|
||||
"charging")
|
||||
(- full-capacity capacity)
|
||||
capacity)
|
||||
60)
|
||||
rate))
|
||||
hours (/ minutes 60)))
|
||||
(list (cons ?c (or (and capacity (number-to-string capacity)) "N/A"))
|
||||
(cons ?L (or (battery-search-for-one-match-in-files
|
||||
|
@ -414,8 +414,7 @@ The following %-sequences are provided:
|
|||
(cons ?p (or (and full-capacity capacity
|
||||
(> full-capacity 0)
|
||||
(number-to-string
|
||||
(floor (/ capacity
|
||||
(/ (float full-capacity) 100)))))
|
||||
(floor (* 100 capacity) full-capacity)))
|
||||
"N/A")))))
|
||||
|
||||
|
||||
|
@ -471,9 +470,9 @@ The following %-sequences are provided:
|
|||
"POWER_SUPPLY_\\(CURRENT\\|POWER\\)_NOW=\\([0-9]*\\)$"
|
||||
nil t)
|
||||
(cl-incf power-now
|
||||
(* (float (string-to-number (match-string 2)))
|
||||
(* (string-to-number (match-string 2))
|
||||
(if (eq (char-after (match-beginning 1)) ?C)
|
||||
voltage-now 1.0))))
|
||||
voltage-now 1))))
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "POWER_SUPPLY_TEMP=\\([0-9]*\\)$" nil t)
|
||||
(setq temperature (match-string 1)))
|
||||
|
@ -585,9 +584,7 @@ The following %-sequences are provided:
|
|||
(when seconds
|
||||
(setq minutes (/ seconds 60)
|
||||
hours (/ minutes 60)
|
||||
remaining-time
|
||||
(format "%d:%02d" (truncate hours)
|
||||
(- (truncate minutes) (* 60 (truncate hours))))))
|
||||
remaining-time (format "%d:%02d" hours (mod minutes 60))))
|
||||
(list (cons ?c (or (and energy
|
||||
(number-to-string (round (* 1000 energy))))
|
||||
"N/A"))
|
||||
|
@ -656,10 +653,9 @@ The following %-sequences are provided:
|
|||
(setq minutes (string-to-number battery-life)
|
||||
seconds (* 60 minutes))
|
||||
(setq seconds (string-to-number battery-life)
|
||||
minutes (truncate (/ seconds 60))))
|
||||
(setq hours (truncate (/ minutes 60))
|
||||
remaining-time (format "%d:%02d" hours
|
||||
(- minutes (* 60 hours)))))
|
||||
minutes (truncate seconds 60)))
|
||||
(setq hours (truncate minutes 60)
|
||||
remaining-time (format "%d:%02d" hours (mod minutes 60))))
|
||||
(list (cons ?L (or line-status "N/A"))
|
||||
(cons ?B (or (car battery-status) "N/A"))
|
||||
(cons ?b (or (cdr battery-status) "N/A"))
|
||||
|
|
|
@ -231,7 +231,7 @@ The result has the proper form for `calendar-daylight-savings-starts'."
|
|||
;; https://lists.gnu.org/r/emacs-pretest-bug/2006-11/msg00060.html
|
||||
(defun calendar-dst-find-data (&optional time)
|
||||
"Find data on the first daylight saving time transitions after TIME.
|
||||
TIME defaults to `current-time'. Return value is as described
|
||||
TIME defaults to the current time. Return value is as described
|
||||
for `calendar-current-time-zone'."
|
||||
(let* ((t0 (or time (current-time)))
|
||||
(t0-zone (current-time-zone t0))
|
||||
|
|
|
@ -643,12 +643,14 @@ FIXME: multiple comma-separated values should be allowed!"
|
|||
(setq year (nth 2 mdy))))
|
||||
;; create the decoded date-time
|
||||
;; FIXME!?!
|
||||
(condition-case nil
|
||||
(decode-time (encode-time second minute hour day month year zone))
|
||||
(error
|
||||
(message "Cannot decode \"%s\"" isodatetimestring)
|
||||
;; hope for the best...
|
||||
(list second minute hour day month year 0 nil 0))))
|
||||
(let ((decoded-time (list second minute hour day month year
|
||||
nil -1 zone)))
|
||||
(condition-case nil
|
||||
(decode-time (encode-time decoded-time 'integer))
|
||||
(error
|
||||
(message "Cannot decode \"%s\"" isodatetimestring)
|
||||
;; Hope for the best....
|
||||
decoded-time))))
|
||||
;; isodatetimestring == nil
|
||||
nil))
|
||||
|
||||
|
@ -1596,8 +1598,7 @@ regular expression matching the start of non-marking entries.
|
|||
ENTRY-MAIN is the first line of the diary entry.
|
||||
|
||||
Optional argument START determines the first day of the
|
||||
enumeration, given as a time value, in same format as returned by
|
||||
`current-time' -- used for test purposes."
|
||||
enumeration, given as a Lisp time value -- used for test purposes."
|
||||
(cond ((string-match (concat nonmarker
|
||||
"%%(and \\(([^)]+)\\))\\(\\s-*.*?\\) ?$")
|
||||
entry-main)
|
||||
|
@ -1621,8 +1622,7 @@ enumeration, given as a time value, in same format as returned by
|
|||
(mapcar
|
||||
(lambda (offset)
|
||||
(let* ((day (decode-time (time-add now
|
||||
(encode-time
|
||||
(* offset 60 60 24)))))
|
||||
(* 60 60 24 offset))))
|
||||
(d (nth 3 day))
|
||||
(m (nth 4 day))
|
||||
(y (nth 5 day))
|
||||
|
|
|
@ -467,16 +467,10 @@ include the second count. If REVERSE-LEADER is non-nil, it means to
|
|||
output a \"+\" if the time value is negative, rather than a \"-\".
|
||||
This is used when negative time values have an inverted meaning (such
|
||||
as with time remaining, where negative time really means overtime)."
|
||||
(if show-seconds
|
||||
(format "%s%d:%02d:%02d"
|
||||
(if (< seconds 0) (if reverse-leader "+" "-") "")
|
||||
(truncate (/ (abs seconds) 60 60))
|
||||
(% (truncate (/ (abs seconds) 60)) 60)
|
||||
(% (truncate (abs seconds)) 60))
|
||||
(format "%s%d:%02d"
|
||||
(let ((s (abs (truncate seconds))))
|
||||
(format (if show-seconds "%s%d:%02d:%02d" "%s%d:%02d")
|
||||
(if (< seconds 0) (if reverse-leader "+" "-") "")
|
||||
(truncate (/ (abs seconds) 60 60))
|
||||
(% (truncate (/ (abs seconds) 60)) 60))))
|
||||
(/ s 3600) (% (/ s 60) 60) (% s 60))))
|
||||
|
||||
(defsubst timeclock-currently-in-p ()
|
||||
"Return non-nil if the user is currently clocked in."
|
||||
|
@ -528,13 +522,12 @@ non-nil, the amount returned will be relative to past time worked."
|
|||
"Return a time value representing the end of today's workday.
|
||||
If TODAY-ONLY is non-nil, the value returned will be relative only to
|
||||
the time worked today, and not to past time."
|
||||
(time-subtract nil
|
||||
(let ((discrep (timeclock-find-discrep)))
|
||||
(if discrep
|
||||
(if today-only
|
||||
(cadr discrep)
|
||||
(car discrep))
|
||||
0))))
|
||||
(time-since (let ((discrep (timeclock-find-discrep)))
|
||||
(if discrep
|
||||
(if today-only
|
||||
(cadr discrep)
|
||||
(car discrep))
|
||||
0))))
|
||||
|
||||
;;;###autoload
|
||||
(defun timeclock-when-to-leave-string (&optional show-seconds
|
||||
|
@ -671,8 +664,8 @@ being logged for. Normally only \"in\" events specify a project."
|
|||
"\n")
|
||||
(if (equal (downcase code) "o")
|
||||
(setq timeclock-last-period
|
||||
(- (float-time now)
|
||||
(float-time (cadr timeclock-last-event)))
|
||||
(float-time
|
||||
(time-subtract now (cadr timeclock-last-event)))
|
||||
timeclock-discrepancy
|
||||
(+ timeclock-discrepancy
|
||||
timeclock-last-period)))
|
||||
|
@ -707,8 +700,7 @@ recorded to disk. If MOMENT is non-nil, use that as the current time.
|
|||
This is only provided for coherency when used by
|
||||
`timeclock-discrepancy'."
|
||||
(if (equal (car timeclock-last-event) "i")
|
||||
(- (float-time moment)
|
||||
(float-time (cadr timeclock-last-event)))
|
||||
(float-time (time-subtract moment (cadr timeclock-last-event)))
|
||||
timeclock-last-period))
|
||||
|
||||
(cl-defstruct (timeclock-entry
|
||||
|
@ -721,8 +713,7 @@ This is only provided for coherency when used by
|
|||
|
||||
(defsubst timeclock-entry-length (entry)
|
||||
"Return the length of ENTRY in seconds."
|
||||
(- (float-time (cadr entry))
|
||||
(float-time (car entry))))
|
||||
(float-time (time-subtract (cadr entry) (car entry))))
|
||||
|
||||
(defsubst timeclock-entry-list-length (entry-list)
|
||||
"Return the total length of ENTRY-LIST in seconds."
|
||||
|
@ -741,8 +732,8 @@ This is only provided for coherency when used by
|
|||
|
||||
(defsubst timeclock-entry-list-span (entry-list)
|
||||
"Return the total time in seconds spanned by ENTRY-LIST."
|
||||
(- (float-time (timeclock-entry-list-end entry-list))
|
||||
(float-time (timeclock-entry-list-begin entry-list))))
|
||||
(float-time (time-subtract (timeclock-entry-list-end entry-list)
|
||||
(timeclock-entry-list-begin entry-list))))
|
||||
|
||||
(defsubst timeclock-entry-list-break (entry-list)
|
||||
"Return the total break time (span - length) in ENTRY-LIST."
|
||||
|
@ -1109,7 +1100,7 @@ discrepancy, today's discrepancy, and the time worked today."
|
|||
last-date-limited nil)
|
||||
(if beg
|
||||
(error "Error in format of timelog file!")
|
||||
(setq beg (float-time (cadr event))))))
|
||||
(setq beg (cadr event)))))
|
||||
((equal (downcase (car event)) "o")
|
||||
(if (and (nth 2 event)
|
||||
(> (length (nth 2 event)) 0))
|
||||
|
@ -1117,7 +1108,7 @@ discrepancy, today's discrepancy, and the time worked today."
|
|||
(if (not beg)
|
||||
(error "Error in format of timelog file!")
|
||||
(setq timeclock-last-period
|
||||
(- (float-time (cadr event)) beg)
|
||||
(float-time (time-subtract (cadr event) beg))
|
||||
accum (+ timeclock-last-period accum)
|
||||
beg nil))
|
||||
(if (equal last-date todays-date)
|
||||
|
@ -1262,12 +1253,11 @@ HTML-P is non-nil, HTML markup is added."
|
|||
(unless (time-less-p
|
||||
(timeclock-day-begin day)
|
||||
(aref lengths i))
|
||||
(let ((base (float-time
|
||||
(timeclock-day-base
|
||||
(timeclock-day-begin day)))))
|
||||
(let ((base (timeclock-day-base (timeclock-day-begin day))))
|
||||
(nconc (aref time-in i)
|
||||
(list (- (float-time (timeclock-day-begin day))
|
||||
base)))
|
||||
(list (float-time (time-subtract
|
||||
(timeclock-day-begin day)
|
||||
base))))
|
||||
(let ((span (timeclock-day-span day))
|
||||
(len (timeclock-day-length day))
|
||||
(req (timeclock-day-required day)))
|
||||
|
@ -1278,8 +1268,9 @@ HTML-P is non-nil, HTML markup is added."
|
|||
(when (and (> span 0)
|
||||
(> (/ (float len) (float span)) 0.70))
|
||||
(nconc (aref time-out i)
|
||||
(list (- (float-time (timeclock-day-end day))
|
||||
base)))
|
||||
(list (float-time (time-subtract
|
||||
(timeclock-day-end day)
|
||||
base))))
|
||||
(nconc (aref breaks i) (list (- span len))))
|
||||
(if req
|
||||
(setq len (+ len (- timeclock-workday req))))
|
||||
|
|
|
@ -198,7 +198,7 @@ Return a cons cell:
|
|||
(ans (ede-detect-directory-for-project default-directory)))
|
||||
(if ans
|
||||
(message "Project found in %d sec @ %s of type %s"
|
||||
(float-time (time-subtract nil start))
|
||||
(encode-time (time-since start) 'integer)
|
||||
(car ans)
|
||||
(eieio-object-name-string (cdr ans)))
|
||||
(message "No Project found.") )))
|
||||
|
|
|
@ -432,7 +432,7 @@ Used to decide whether to save completions.")
|
|||
|
||||
|
||||
(defun cmpl-hours-since-origin ()
|
||||
(floor (float-time) 3600))
|
||||
(floor (encode-time nil 'integer) 3600))
|
||||
|
||||
;;---------------------------------------------------------------------------
|
||||
;; "Symbol" parsing functions
|
||||
|
|
|
@ -1544,10 +1544,10 @@ and try to load that."
|
|||
;; for the sake of `clean-buffer-list': preserving the invariant
|
||||
;; "how much time the user spent in Emacs without looking at this buffer".
|
||||
(setq buffer-display-time
|
||||
(if buffer-display-time
|
||||
(time-add buffer-display-time
|
||||
(time-subtract nil desktop-file-modtime))
|
||||
(current-time)))
|
||||
(time-since (if buffer-display-time
|
||||
(time-subtract desktop-file-modtime
|
||||
buffer-display-time)
|
||||
0)))
|
||||
(unless (< desktop-file-version 208) ; Don't misinterpret any old custom args
|
||||
(dolist (record compacted-vars)
|
||||
(let*
|
||||
|
|
|
@ -210,7 +210,7 @@ matches."
|
|||
(defun ecomplete-decay-1 (elem)
|
||||
;; We subtract 5% from the item for each week it hasn't been used.
|
||||
(/ (car elem)
|
||||
(expt 1.05 (/ (- (float-time) (cadr elem))
|
||||
(expt 1.05 (/ (float-time (time-since (cadr elem)))
|
||||
(* 7 24 60 60)))))
|
||||
|
||||
;; `ecomplete-get-matches' uses substring matching, so also use the `substring'
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
`(let (,t1)
|
||||
(setq ,t1 (current-time))
|
||||
,@forms
|
||||
(float-time (time-subtract nil ,t1)))))
|
||||
(float-time (time-since ,t1)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro benchmark-run (&optional repetitions &rest forms)
|
||||
|
|
|
@ -1822,13 +1822,13 @@ determines how frequently the progress display is updated.")
|
|||
(force-mode-line-update)
|
||||
(redisplay t)
|
||||
(setf (ert--stats-next-redisplay stats)
|
||||
(+ (float-time) ert-test-run-redisplay-interval-secs)))
|
||||
(float-time (time-add nil ert-test-run-redisplay-interval-secs))))
|
||||
|
||||
(defun ert--results-update-stats-display-maybe (ewoc stats)
|
||||
"Call `ert--results-update-stats-display' if not called recently.
|
||||
|
||||
EWOC and STATS are arguments for `ert--results-update-stats-display'."
|
||||
(when (>= (float-time) (ert--stats-next-redisplay stats))
|
||||
(unless (time-less-p nil (ert--stats-next-redisplay stats))
|
||||
(ert--results-update-stats-display ewoc stats)))
|
||||
|
||||
(defun ert--tests-running-mode-line-indicator ()
|
||||
|
|
|
@ -37,16 +37,14 @@
|
|||
;; Idle.
|
||||
(if (aref timer 7) "*" " ")
|
||||
;; Next time.
|
||||
(let ((time (float-time (list (aref timer 1)
|
||||
(aref timer 2)
|
||||
(aref timer 3)))))
|
||||
(let ((time (list (aref timer 1)
|
||||
(aref timer 2)
|
||||
(aref timer 3))))
|
||||
(format "%.2f"
|
||||
(if (aref timer 7)
|
||||
time
|
||||
(- (float-time (list (aref timer 1)
|
||||
(aref timer 2)
|
||||
(aref timer 3)))
|
||||
(float-time)))))
|
||||
(float-time
|
||||
(if (aref timer 7)
|
||||
time
|
||||
(time-subtract time nil)))))
|
||||
;; Repeat.
|
||||
(let ((repeat (aref timer 4)))
|
||||
(cond
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
(defun timer-set-time (timer time &optional delta)
|
||||
"Set the trigger time of TIMER to TIME.
|
||||
TIME must be in the internal format returned by, e.g., `current-time'.
|
||||
TIME must be a Lisp time value.
|
||||
If optional third argument DELTA is a positive number, make the timer
|
||||
fire repeatedly that many seconds apart."
|
||||
(setf (timer--time timer) time)
|
||||
|
@ -249,8 +249,8 @@ how many will really happen."
|
|||
(defun timer-until (timer time)
|
||||
"Calculate number of seconds from when TIMER will run, until TIME.
|
||||
TIMER is a timer, and stands for the time when its next repeat is scheduled.
|
||||
TIME is a time-list."
|
||||
(- (float-time time) (float-time (timer--time timer))))
|
||||
TIME is a Lisp time value."
|
||||
(float-time (time-subtract time (timer--time timer))))
|
||||
|
||||
(defun timer-event-handler (timer)
|
||||
"Call the handler for the timer TIMER.
|
||||
|
@ -281,7 +281,7 @@ This function is called, by name, directly by the C code."
|
|||
;; perhaps because Emacs was suspended for a long time,
|
||||
;; limit how many times things get repeated.
|
||||
(if (and (numberp timer-max-repeats)
|
||||
(< 0 (timer-until timer nil)))
|
||||
(time-less-p nil (timer--time timer)))
|
||||
(let ((repeats (/ (timer-until timer nil)
|
||||
(timer--repeat-delay timer))))
|
||||
(if (> repeats timer-max-repeats)
|
||||
|
|
|
@ -844,10 +844,9 @@ Additionally, detect whether the IRC process has hung."
|
|||
erc-server-last-received-time))
|
||||
(with-current-buffer buf
|
||||
(if (and erc-server-send-ping-timeout
|
||||
(>
|
||||
(erc-time-diff (erc-current-time)
|
||||
erc-server-last-received-time)
|
||||
erc-server-send-ping-timeout))
|
||||
(time-less-p
|
||||
erc-server-send-ping-timeout
|
||||
(time-since erc-server-last-received-time)))
|
||||
(progn
|
||||
;; if the process is hung, kill it
|
||||
(setq erc-server-timed-out t)
|
||||
|
@ -865,16 +864,15 @@ Additionally, detect whether the IRC process has hung."
|
|||
See `erc-server-flood-margin' for an explanation of the flood
|
||||
protection algorithm."
|
||||
(with-current-buffer buffer
|
||||
(let ((now (erc-current-time)))
|
||||
(let ((now (current-time)))
|
||||
(when erc-server-flood-timer
|
||||
(erc-cancel-timer erc-server-flood-timer)
|
||||
(setq erc-server-flood-timer nil))
|
||||
(when (< erc-server-flood-last-message
|
||||
now)
|
||||
(setq erc-server-flood-last-message now))
|
||||
(when (time-less-p erc-server-flood-last-message now)
|
||||
(setq erc-server-flood-last-message (erc-emacs-time-to-erc-time now)))
|
||||
(while (and erc-server-flood-queue
|
||||
(< erc-server-flood-last-message
|
||||
(+ now erc-server-flood-margin)))
|
||||
(time-less-p erc-server-flood-last-message
|
||||
(time-add now erc-server-flood-margin)))
|
||||
(let ((msg (caar erc-server-flood-queue))
|
||||
(encoding (cdar erc-server-flood-queue)))
|
||||
(setq erc-server-flood-queue (cdr erc-server-flood-queue)
|
||||
|
@ -1070,8 +1068,8 @@ Hands off to helper functions via `erc-call-hooks'."
|
|||
erc-server-prevent-duplicates)
|
||||
(let ((m (erc-response.unparsed parsed-response)))
|
||||
;; duplicate suppression
|
||||
(if (< (or (gethash m erc-server-duplicates) 0)
|
||||
(- (erc-current-time) erc-server-duplicate-timeout))
|
||||
(if (time-less-p (or (gethash m erc-server-duplicates) 0)
|
||||
(time-since erc-server-duplicate-timeout))
|
||||
(erc-call-hooks process parsed-response))
|
||||
(puthash m (erc-current-time) erc-server-duplicates))
|
||||
;; Hand off to the relevant handler.
|
||||
|
@ -1447,7 +1445,7 @@ add things to `%s' instead."
|
|||
"Handle pong messages." nil
|
||||
(let ((time (string-to-number (erc-response.contents parsed))))
|
||||
(when (> time 0)
|
||||
(setq erc-server-lag (erc-time-diff time (erc-current-time)))
|
||||
(setq erc-server-lag (erc-time-diff time nil))
|
||||
(when erc-verbose-server-ping
|
||||
(erc-display-message
|
||||
parsed 'notice proc 'PONG
|
||||
|
@ -1730,7 +1728,7 @@ See `erc-display-server-message'." nil
|
|||
(cdr (erc-response.command-args parsed))))
|
||||
(setq time (when on-since
|
||||
(format-time-string erc-server-timestamp-format
|
||||
(erc-string-to-emacs-time on-since))))
|
||||
(string-to-number on-since))))
|
||||
(erc-update-user-nick nick nick nil nil nil
|
||||
(and time (format "on since %s" time)))
|
||||
(if time
|
||||
|
@ -1802,7 +1800,7 @@ See `erc-display-server-message'." nil
|
|||
(define-erc-response-handler (329)
|
||||
"Channel creation date." nil
|
||||
(let ((channel (cadr (erc-response.command-args parsed)))
|
||||
(time (erc-string-to-emacs-time
|
||||
(time (string-to-number
|
||||
(nth 2 (erc-response.command-args parsed)))))
|
||||
(erc-display-message
|
||||
parsed 'notice (erc-get-buffer channel proc)
|
||||
|
@ -1844,7 +1842,7 @@ See `erc-display-server-message'." nil
|
|||
(pcase-let ((`(,channel ,nick ,time)
|
||||
(cdr (erc-response.command-args parsed))))
|
||||
(setq time (format-time-string erc-server-timestamp-format
|
||||
(erc-string-to-emacs-time time)))
|
||||
(string-to-number time)))
|
||||
(erc-update-channel-topic channel
|
||||
(format "\C-o (%s, %s)" nick time)
|
||||
'append)
|
||||
|
|
|
@ -1024,7 +1024,7 @@ transfer is complete."
|
|||
?s (number-to-string erc-dcc-byte-count)
|
||||
?t (format "%.0f"
|
||||
(erc-time-diff (plist-get erc-dcc-entry-data :start-time)
|
||||
(erc-current-time)))))
|
||||
nil))))
|
||||
(kill-buffer (process-buffer proc))
|
||||
(delete-process proc))
|
||||
|
||||
|
|
|
@ -601,7 +601,7 @@ See `erc-log-match-format'."
|
|||
'timestamp))))
|
||||
(away-time (erc-emacs-time-to-erc-time (erc-away-time))))
|
||||
(when (and away-time last-msg-time
|
||||
(erc-time-gt last-msg-time away-time))
|
||||
(time-less-p away-time last-msg-time))
|
||||
(erc-display-message
|
||||
nil 'notice 'active
|
||||
(format "You have logged messages waiting in \"%s\"."
|
||||
|
|
|
@ -630,8 +630,8 @@ only consider active buffers visible.")
|
|||
(if erc-track-when-inactive
|
||||
(when erc-buffer-activity; could be nil
|
||||
(and (erc-track-get-buffer-window buffer erc-track-visibility)
|
||||
(<= (erc-time-diff erc-buffer-activity (erc-current-time))
|
||||
erc-buffer-activity-timeout)))
|
||||
(not (time-less-p erc-buffer-activity-timeout
|
||||
(erc-time-diff erc-buffer-activity nil)))))
|
||||
(erc-track-get-buffer-window buffer erc-track-visibility)))
|
||||
|
||||
;;; Tracking the channel modifications
|
||||
|
|
|
@ -2565,8 +2565,8 @@ consumption for long-lived IRC or Emacs sessions."
|
|||
(maphash
|
||||
(lambda (nick last-PRIVMSG-time)
|
||||
(when
|
||||
(> (float-time (time-subtract nil last-PRIVMSG-time))
|
||||
erc-lurker-threshold-time)
|
||||
(time-less-p erc-lurker-threshold-time
|
||||
(time-since last-PRIVMSG-time))
|
||||
(remhash nick hash)))
|
||||
hash)
|
||||
(if (zerop (hash-table-count hash))
|
||||
|
@ -2631,9 +2631,8 @@ server within `erc-lurker-threshold-time'. See also
|
|||
(gethash (erc-lurker-maybe-trim nick)
|
||||
(gethash server erc-lurker-state (make-hash-table)))))
|
||||
(or (null last-PRIVMSG-time)
|
||||
(> (float-time
|
||||
(time-subtract nil last-PRIVMSG-time))
|
||||
erc-lurker-threshold-time))))
|
||||
(time-less-p erc-lurker-threshold-time
|
||||
(time-since last-PRIVMSG-time)))))
|
||||
|
||||
(defcustom erc-common-server-suffixes
|
||||
'(("openprojects.net\\'" . "OPN")
|
||||
|
@ -3412,7 +3411,7 @@ Otherwise leave the channel indicated by LINE."
|
|||
|
||||
(defun erc-cmd-PING (recipient)
|
||||
"Ping RECIPIENT."
|
||||
(let ((time (format "%f" (erc-current-time))))
|
||||
(let ((time (format-time-string "%s.%6N")))
|
||||
(erc-log (format "cmd: PING: %s" time))
|
||||
(erc-cmd-CTCP recipient "PING" time)))
|
||||
|
||||
|
@ -4640,7 +4639,7 @@ See also `erc-display-message'."
|
|||
(user-full-name)
|
||||
(user-login-name)
|
||||
(system-name))))
|
||||
(ns (erc-time-diff erc-server-last-sent-time (erc-current-time))))
|
||||
(ns (erc-time-diff erc-server-last-sent-time nil)))
|
||||
(when (> ns 0)
|
||||
(setq s (concat s " Idle for " (erc-sec-to-time ns))))
|
||||
(erc-send-ctcp-notice nick s)))
|
||||
|
@ -4729,8 +4728,7 @@ See also `erc-display-message'."
|
|||
nil
|
||||
(let ((time (match-string 1 msg)))
|
||||
(condition-case nil
|
||||
(let ((delta (erc-time-diff (string-to-number time)
|
||||
(erc-current-time))))
|
||||
(let ((delta (erc-time-diff (string-to-number time) nil)))
|
||||
(erc-display-message
|
||||
nil 'notice 'active
|
||||
'CTCP-PING ?n nick
|
||||
|
@ -4788,10 +4786,7 @@ If non-nil, return from being away."
|
|||
(erc-default-target)
|
||||
(if away-time
|
||||
(format "is back (gone for %s)"
|
||||
(erc-sec-to-time
|
||||
(erc-time-diff
|
||||
(erc-emacs-time-to-erc-time away-time)
|
||||
(erc-current-time))))
|
||||
(erc-sec-to-time (erc-time-diff away-time nil)))
|
||||
"is back")))))))))
|
||||
(erc-update-mode-line)))
|
||||
|
||||
|
@ -5383,10 +5378,10 @@ submitted line to be intentional."
|
|||
(defun erc-send-current-line ()
|
||||
"Parse current line and send it to IRC."
|
||||
(interactive)
|
||||
(let ((now (float-time)))
|
||||
(let ((now (current-time)))
|
||||
(if (or (not erc-accidental-paste-threshold-seconds)
|
||||
(< erc-accidental-paste-threshold-seconds
|
||||
(- now erc-last-input-time)))
|
||||
(time-less-p erc-accidental-paste-threshold-seconds
|
||||
(time-subtract now erc-last-input-time)))
|
||||
(save-restriction
|
||||
(widen)
|
||||
(if (< (point) (erc-beg-of-input-line))
|
||||
|
@ -6036,22 +6031,20 @@ non-nil value is found.
|
|||
|
||||
;; time routines
|
||||
|
||||
(defun erc-string-to-emacs-time (string)
|
||||
"Convert the long number represented by STRING into an Emacs timestamp."
|
||||
(let* ((n (string-to-number (concat string ".0"))))
|
||||
(list (truncate (/ n 65536))
|
||||
(truncate (mod n 65536)))))
|
||||
(define-obsolete-function-alias 'erc-string-to-emacs-time 'string-to-number
|
||||
"27.1")
|
||||
|
||||
(defalias 'erc-emacs-time-to-erc-time 'float-time)
|
||||
(defalias 'erc-current-time 'float-time)
|
||||
|
||||
(defun erc-time-diff (t1 t2)
|
||||
"Return the time difference in seconds between T1 and T2."
|
||||
(abs (- t2 t1)))
|
||||
"Return the absolute value of the difference in seconds between T1 and T2."
|
||||
(abs (float-time (time-subtract t1 t2))))
|
||||
|
||||
(defun erc-time-gt (t1 t2)
|
||||
"Check whether T1 > T2."
|
||||
(> t1 t2))
|
||||
(declare (obsolete time-less-p "27.1"))
|
||||
(time-less-p t2 t1))
|
||||
|
||||
(defun erc-sec-to-time (ns)
|
||||
"Convert NS to a time string HH:MM.SS."
|
||||
|
|
|
@ -421,9 +421,8 @@ resultant list of strings."
|
|||
(forward-char))
|
||||
(if (looking-at "[0-9]+")
|
||||
(progn
|
||||
(setq when (- (float-time)
|
||||
(* (string-to-number (match-string 0))
|
||||
quantum)))
|
||||
(setq when (time-since (* (string-to-number (match-string 0))
|
||||
quantum)))
|
||||
(goto-char (match-end 0)))
|
||||
(setq open (char-after))
|
||||
(if (setq close (memq open '(?\( ?\[ ?\< ?\{)))
|
||||
|
@ -438,17 +437,17 @@ resultant list of strings."
|
|||
(attrs (file-attributes file)))
|
||||
(unless attrs
|
||||
(error "Cannot stat file `%s'" file))
|
||||
(setq when (float-time (nth attr-index attrs))))
|
||||
(setq when (nth attr-index attrs)))
|
||||
(goto-char (1+ end)))
|
||||
`(lambda (file)
|
||||
(let ((attrs (file-attributes file)))
|
||||
(if attrs
|
||||
(,(if (eq qual ?-)
|
||||
'<
|
||||
'time-less-p
|
||||
(if (eq qual ?+)
|
||||
'>
|
||||
'=)) ,when (float-time
|
||||
(nth ,attr-index attrs))))))))
|
||||
'(lambda (a b) (time-less-p b a))
|
||||
'time-equal-p))
|
||||
,when (nth ,attr-index attrs)))))))
|
||||
|
||||
(defun eshell-pred-file-type (type)
|
||||
"Return a test which tests that the file is of a certain TYPE.
|
||||
|
|
|
@ -943,7 +943,8 @@ Summarize disk usage of each FILE, recursively for directories.")
|
|||
(defvar eshell-time-start nil)
|
||||
|
||||
(defun eshell-show-elapsed-time ()
|
||||
(let ((elapsed (format "%.3f secs\n" (- (float-time) eshell-time-start))))
|
||||
(let ((elapsed (format "%.3f secs\n"
|
||||
(float-time (time-since eshell-time-start)))))
|
||||
(set-text-properties 0 (length elapsed) '(face bold) elapsed)
|
||||
(eshell-interactive-print elapsed))
|
||||
(remove-hook 'eshell-post-command-hook 'eshell-show-elapsed-time t))
|
||||
|
|
|
@ -3610,7 +3610,7 @@ possible values."
|
|||
(defun article-lapsed-string (time &optional max-segments)
|
||||
;; If the date is seriously mangled, the timezone functions are
|
||||
;; liable to bug out, so we ignore all errors.
|
||||
(let* ((real-time (time-subtract nil time))
|
||||
(let* ((real-time (time-since time))
|
||||
(real-sec (float-time real-time))
|
||||
(sec (abs real-sec))
|
||||
(segments 0)
|
||||
|
|
|
@ -93,7 +93,7 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
|
|||
|
||||
(defun gnus-demon-idle-since ()
|
||||
"Return the number of seconds since when Emacs is idle."
|
||||
(float-time (or (current-idle-time) '(0 0 0))))
|
||||
(float-time (or (current-idle-time) 0)))
|
||||
|
||||
(defun gnus-demon-run-callback (func &optional idle time special)
|
||||
"Run FUNC if Emacs has been idle for longer than IDLE seconds.
|
||||
|
|
|
@ -4590,7 +4590,7 @@ or `gnus-group-catchup-group-hook'."
|
|||
;; 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)))
|
||||
(delta (time-since time)))
|
||||
(float-time delta)))
|
||||
|
||||
(defun gnus-group-timestamp-string (group)
|
||||
|
|
|
@ -413,13 +413,12 @@ Return nil for non-recurring EVENT."
|
|||
(end-time (format-time-string "%H:%M" end))
|
||||
(end-at-midnight (string= end-time "00:00"))
|
||||
(start-end-date-diff
|
||||
(/ (float-time (time-subtract
|
||||
(org-time-string-to-time end-date)
|
||||
(org-time-string-to-time start-date)))
|
||||
86400))
|
||||
(time-to-number-of-days (time-subtract
|
||||
(org-time-string-to-time end-date)
|
||||
(org-time-string-to-time start-date))))
|
||||
(org-repeat (gnus-icalendar-event:org-repeat event))
|
||||
(repeat (if org-repeat (concat " " org-repeat) ""))
|
||||
(time-1-day '(0 86400)))
|
||||
(time-1-day 86400))
|
||||
|
||||
;; NOTE: special care is needed with appointments ending at midnight
|
||||
;; (typically all-day events): the end time has to be changed to 23:59 to
|
||||
|
|
|
@ -257,7 +257,8 @@ If it is down, start it up (again)."
|
|||
(insert (format-time-string "%H:%M:%S")
|
||||
(format " %.2fs %s %S\n"
|
||||
(if (numberp gnus-backend-trace-elapsed)
|
||||
(- (float-time) gnus-backend-trace-elapsed)
|
||||
(float-time
|
||||
(time-since gnus-backend-trace-elapsed))
|
||||
0)
|
||||
type form))
|
||||
(setq gnus-backend-trace-elapsed (float-time)))))
|
||||
|
|
|
@ -1501,7 +1501,7 @@ If FORMAT, also format the current score file."
|
|||
(when (and gnus-summary-default-score
|
||||
scores)
|
||||
(let* ((entries gnus-header-index)
|
||||
(now (time-to-days (current-time)))
|
||||
(now (time-to-days nil))
|
||||
(expire (and gnus-score-expiry-days
|
||||
(- now gnus-score-expiry-days)))
|
||||
(headers gnus-newsgroup-headers)
|
||||
|
@ -2380,7 +2380,7 @@ score in `gnus-newsgroup-scored' by SCORE."
|
|||
(memq 'word gnus-newsgroup-adaptive))
|
||||
(with-temp-buffer
|
||||
(let* ((hashtb (gnus-make-hashtable 1000))
|
||||
(date (time-to-days (current-time)))
|
||||
(date (time-to-days nil))
|
||||
(data gnus-newsgroup-data)
|
||||
word d score val)
|
||||
(with-syntax-table gnus-adaptive-word-syntax-table
|
||||
|
|
|
@ -3855,20 +3855,20 @@ respectively."
|
|||
Returns \" ? \" if there's bad input or if another error occurs.
|
||||
Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
|
||||
(condition-case ()
|
||||
(let* ((messy-date (float-time (gnus-date-get-time messy-date)))
|
||||
(now (float-time))
|
||||
(let* ((messy-date (gnus-date-get-time messy-date))
|
||||
(now (current-time))
|
||||
;;If we don't find something suitable we'll use this one
|
||||
(my-format "%b %d '%y"))
|
||||
(let* ((difference (- now messy-date))
|
||||
(let* ((difference (time-subtract now messy-date))
|
||||
(templist gnus-user-date-format-alist)
|
||||
(top (eval (caar templist))))
|
||||
(while (if (numberp top) (< top difference) (not top))
|
||||
(while (if (numberp top) (time-less-p top difference) (not top))
|
||||
(progn
|
||||
(setq templist (cdr templist))
|
||||
(setq top (eval (caar templist)))))
|
||||
(if (stringp (cdr (car templist)))
|
||||
(setq my-format (cdr (car templist)))))
|
||||
(format-time-string (eval my-format) (encode-time messy-date)))
|
||||
(format-time-string (eval my-format) messy-date))
|
||||
(error " ? ")))
|
||||
|
||||
(defun gnus-summary-set-local-parameters (group)
|
||||
|
@ -5093,8 +5093,8 @@ Unscored articles will be counted as having a score of zero."
|
|||
"Return the highest article date in THREAD."
|
||||
(apply 'max
|
||||
(mapcar (lambda (header) (float-time
|
||||
(gnus-date-get-time
|
||||
(mail-header-date header))))
|
||||
(gnus-date-get-time
|
||||
(mail-header-date header))))
|
||||
(flatten-tree thread))))
|
||||
|
||||
(defun gnus-thread-total-score-1 (root)
|
||||
|
|
|
@ -647,9 +647,9 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
|
|||
;; Don't check for old incoming files more than once per day to
|
||||
;; save a lot of file accesses.
|
||||
(when (or (null mail-source-incoming-last-checked-time)
|
||||
(> (float-time
|
||||
(time-since mail-source-incoming-last-checked-time))
|
||||
(* 24 60 60)))
|
||||
(time-less-p
|
||||
(* 24 60 60)
|
||||
(time-since mail-source-incoming-last-checked-time)))
|
||||
(setq mail-source-incoming-last-checked-time (current-time))
|
||||
(mail-source-delete-old-incoming
|
||||
mail-source-delete-incoming
|
||||
|
|
|
@ -319,7 +319,7 @@ included.")
|
|||
"Subject: " (file-name-nondirectory file) (or extra-msg "") "\n"
|
||||
"Message-ID: <nneething-" (nneething-encode-file-name file)
|
||||
"@" (system-name) ">\n"
|
||||
(if (zerop (float-time (file-attribute-modification-time atts))) ""
|
||||
(if (time-equal-p 0 (file-attribute-modification-time atts)) ""
|
||||
(concat "Date: "
|
||||
(current-time-string (file-attribute-modification-time atts))
|
||||
"\n"))
|
||||
|
|
|
@ -1075,7 +1075,7 @@ See `find-file-noselect' for the arguments."
|
|||
(defvar nnheader-last-message-time '(0 0))
|
||||
(defun nnheader-message-maybe (&rest args)
|
||||
(let ((now (current-time)))
|
||||
(when (> (float-time (time-subtract now nnheader-last-message-time)) 1)
|
||||
(when (time-less-p 1 (time-subtract now nnheader-last-message-time))
|
||||
(setq nnheader-last-message-time now)
|
||||
(apply 'nnheader-message args))))
|
||||
|
||||
|
|
|
@ -386,12 +386,12 @@ textual parts.")
|
|||
(with-current-buffer buffer
|
||||
(when (and nnimap-object
|
||||
(nnimap-last-command-time nnimap-object)
|
||||
(> (float-time
|
||||
(time-subtract
|
||||
now
|
||||
(nnimap-last-command-time nnimap-object)))
|
||||
;; More than five minutes since the last command.
|
||||
(* 5 60)))
|
||||
(time-less-p
|
||||
;; More than five minutes since the last command.
|
||||
(* 5 60)
|
||||
(time-subtract
|
||||
now
|
||||
(nnimap-last-command-time nnimap-object))))
|
||||
(ignore-errors ;E.g. "buffer foo has no process".
|
||||
(nnimap-send-command "NOOP"))))))))
|
||||
|
||||
|
|
|
@ -1882,7 +1882,7 @@ If TIME is nil, then return the cutoff time for oldness instead."
|
|||
(setq days (days-to-time days))
|
||||
;; Compare the time with the current time.
|
||||
(if (null time)
|
||||
(time-subtract nil days)
|
||||
(time-since days)
|
||||
(ignore-errors (time-less-p days (time-since time)))))))))
|
||||
|
||||
(declare-function gnus-group-mark-article-read "gnus-group" (group article))
|
||||
|
|
|
@ -764,7 +764,7 @@ This variable is set by `nnmaildir-request-article'.")
|
|||
|
||||
(defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls)
|
||||
(catch 'return
|
||||
(let ((36h-ago (- (float-time) 129600))
|
||||
(let ((36h-ago (time-since 129600))
|
||||
absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
|
||||
files num dir flist group x)
|
||||
(setq absdir (nnmaildir--srvgrp-dir srv-dir gname)
|
||||
|
@ -1577,7 +1577,7 @@ This variable is set by `nnmaildir-request-article'.")
|
|||
(when no-force
|
||||
(unless (integerp time) ;; handle 'never
|
||||
(throw 'return (gnus-uncompress-range ranges)))
|
||||
(setq boundary (time-subtract nil time)))
|
||||
(setq boundary (time-since time)))
|
||||
(setq dir (nnmaildir--srv-dir nnmaildir--cur-server)
|
||||
dir (nnmaildir--srvgrp-dir dir gname)
|
||||
dir (nnmaildir--cur dir)
|
||||
|
|
|
@ -1948,11 +1948,10 @@ Otherwise buffers whose name matches an element of
|
|||
(ibuffer-mark-on-buffer
|
||||
#'(lambda (buf)
|
||||
(with-current-buffer buf
|
||||
;; hacked from midnight.el
|
||||
(when buffer-display-time
|
||||
(let* ((now (float-time))
|
||||
(then (float-time buffer-display-time)))
|
||||
(> (- now then) (* 60 60 ibuffer-old-time))))))))
|
||||
(time-less-p
|
||||
(* 60 60 ibuffer-old-time)
|
||||
(time-since buffer-display-time)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun ibuffer-mark-special-buffers ()
|
||||
|
|
|
@ -804,19 +804,22 @@ If the image has a non-nil :speed property, it acts as a multiplier
|
|||
for the animation speed. A negative value means to animate in reverse."
|
||||
(when (and (buffer-live-p (plist-get (cdr image) :animate-buffer))
|
||||
;; Delayed more than two seconds more than expected.
|
||||
(or (<= (- (float-time) target-time) 2)
|
||||
(or (time-less-p (time-since target-time) 2)
|
||||
(progn
|
||||
(message "Stopping animation; animation possibly too big")
|
||||
nil)))
|
||||
(image-show-frame image n t)
|
||||
(let* ((speed (image-animate-get-speed image))
|
||||
(time (float-time))
|
||||
(time (current-time))
|
||||
(animation (image-multi-frame-p image))
|
||||
(time-to-load-image (time-since time))
|
||||
(stated-delay-time (/ (or (cdr animation)
|
||||
image-default-frame-delay)
|
||||
(float (abs speed))))
|
||||
;; Subtract off the time we took to load the image from the
|
||||
;; stated delay time.
|
||||
(delay (max (+ (* (or (cdr animation) image-default-frame-delay)
|
||||
(/ 1.0 (abs speed)))
|
||||
time (- (float-time)))
|
||||
(delay (max (float-time (time-subtract stated-delay-time
|
||||
time-to-load-image))
|
||||
image-minimum-frame-delay))
|
||||
done)
|
||||
(setq n (if (< speed 0)
|
||||
|
|
|
@ -2369,7 +2369,7 @@ mapped to mostly alphanumerics for safety."
|
|||
|
||||
(defun feedmail-rfc822-date (arg-time)
|
||||
(feedmail-say-debug ">in-> feedmail-rfc822-date %s" arg-time)
|
||||
(let ((time (if arg-time arg-time (current-time)))
|
||||
(let ((time (or arg-time (current-time)))
|
||||
(system-time-locale "C"))
|
||||
(concat
|
||||
(format-time-string "%a, %e %b %Y %T " time)
|
||||
|
|
|
@ -98,7 +98,7 @@ point at the click position."
|
|||
|
||||
(defun mouse--down-1-maybe-follows-link (&optional _prompt)
|
||||
(when mouse-1-click-follows-link
|
||||
(setq mouse--last-down (cons (car-safe last-input-event) (float-time))))
|
||||
(setq mouse--last-down (cons (car-safe last-input-event) (current-time))))
|
||||
nil)
|
||||
|
||||
(defun mouse--click-1-maybe-follows-link (&optional _prompt)
|
||||
|
@ -110,8 +110,10 @@ Expects to be bound to `(double-)mouse-1' in `key-translation-map'."
|
|||
('double (eq 'double-mouse-1 (car-safe last-input-event)))
|
||||
(_ (and (eq 'mouse-1 (car-safe last-input-event))
|
||||
(or (not (numberp mouse-1-click-follows-link))
|
||||
(funcall (if (< mouse-1-click-follows-link 0) #'> #'<)
|
||||
(- (float-time) (cdr mouse--last-down))
|
||||
(funcall (if (< mouse-1-click-follows-link 0)
|
||||
(lambda (a b) (time-less-p b a))
|
||||
#'time-less-p)
|
||||
(time-since (cdr mouse--last-down))
|
||||
(/ (abs mouse-1-click-follows-link) 1000.0))))))
|
||||
(eq (car mouse--last-down)
|
||||
(event-convert-list (list 'down (car-safe last-input-event))))
|
||||
|
|
11
lisp/mpc.el
11
lisp/mpc.el
|
@ -2555,7 +2555,6 @@ If stopped, start playback."
|
|||
(defvar mpc--faster-toggle-forward nil)
|
||||
(defvar mpc--faster-acceleration 0.5)
|
||||
(defun mpc--faster-toggle (speedup step)
|
||||
(setq speedup (float speedup))
|
||||
(if mpc--faster-toggle-timer
|
||||
(mpc--faster-stop)
|
||||
(mpc-status-refresh) (mpc-proc-sync)
|
||||
|
@ -2582,7 +2581,7 @@ If stopped, start playback."
|
|||
(setq songtime (string-to-number
|
||||
(cdr (assq 'time mpc-status))))
|
||||
(setq songduration (mpc--songduration))
|
||||
(setq oldtime (float-time)))
|
||||
(setq oldtime (current-time)))
|
||||
((and (>= songtime songduration) mpc--faster-toggle-forward)
|
||||
;; Skip to the beginning of the next song.
|
||||
(if (not (equal (cdr (assq 'state mpc-status)) "play"))
|
||||
|
@ -2601,14 +2600,16 @@ If stopped, start playback."
|
|||
(lambda ()
|
||||
(setq songid (cdr (assq 'songid mpc-status)))
|
||||
(setq songtime (setq songduration (mpc--songduration)))
|
||||
(setq oldtime (float-time))
|
||||
(setq oldtime (current-time))
|
||||
(mpc-proc-cmd (list "seekid" songid songtime)))))))
|
||||
(t
|
||||
(setq speedup (+ speedup mpc--faster-acceleration))
|
||||
(let ((newstep
|
||||
(truncate (* speedup (- (float-time) oldtime)))))
|
||||
(truncate
|
||||
(* speedup
|
||||
(float-time (time-since oldtime))))))
|
||||
(if (<= newstep 1) (setq newstep 1))
|
||||
(setq oldtime (+ oldtime (/ newstep speedup)))
|
||||
(setq oldtime (time-add oldtime (/ newstep speedup)))
|
||||
(if (not mpc--faster-toggle-forward)
|
||||
(setq newstep (- newstep)))
|
||||
(setq songtime (min songduration (+ songtime newstep)))
|
||||
|
|
|
@ -1918,11 +1918,7 @@ on failure."
|
|||
(unless (< len 10)
|
||||
(setq imap-have-messaged t)
|
||||
(message "imap read: %dk" len))
|
||||
(accept-process-output imap-process
|
||||
(truncate imap-read-timeout)
|
||||
(truncate (* (- imap-read-timeout
|
||||
(truncate imap-read-timeout))
|
||||
1000)))))
|
||||
(accept-process-output imap-process imap-read-timeout)))
|
||||
;; A process can die _before_ we have processed everything it
|
||||
;; has to say. Moreover, this can happen in between the call to
|
||||
;; accept-process-output and the call to process-status in an
|
||||
|
|
|
@ -1802,7 +1802,7 @@ download it from URL first."
|
|||
(time-less-p nil
|
||||
(time-add (file-attribute-modification-time
|
||||
(file-attributes image-name))
|
||||
(encode-time 86400))))
|
||||
86400)))
|
||||
(newsticker--debug-msg "%s: Getting image for %s skipped"
|
||||
(format-time-string "%A, %H:%M")
|
||||
feed-name)
|
||||
|
@ -1995,8 +1995,7 @@ older than TIME."
|
|||
(mapc
|
||||
(lambda (item)
|
||||
(when (eq (newsticker--age item) old-age)
|
||||
(let ((exp-time (time-add (newsticker--time item)
|
||||
(encode-time time))))
|
||||
(let ((exp-time (time-add (newsticker--time item) time)))
|
||||
(when (time-less-p exp-time nil)
|
||||
(newsticker--debug-msg
|
||||
"Item `%s' from %s has expired on %s"
|
||||
|
|
|
@ -670,8 +670,9 @@ last ping."
|
|||
|
||||
(defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message)
|
||||
(with-rcirc-process-buffer process
|
||||
(setq header-line-format (format "%f" (- (float-time)
|
||||
(string-to-number message))))))
|
||||
(setq header-line-format
|
||||
(format "%f" (float-time
|
||||
(time-since (string-to-number message)))))))
|
||||
|
||||
(defvar rcirc-debug-buffer "*rcirc debug*")
|
||||
(defvar rcirc-debug-flag nil
|
||||
|
@ -723,8 +724,8 @@ When 0, do not auto-reconnect."
|
|||
(< 0 rcirc-reconnect-delay))
|
||||
(let ((now (current-time)))
|
||||
(when (or (null rcirc-last-connect-time)
|
||||
(< rcirc-reconnect-delay
|
||||
(float-time (time-subtract now rcirc-last-connect-time))))
|
||||
(time-less-p rcirc-reconnect-delay
|
||||
(time-subtract now rcirc-last-connect-time)))
|
||||
(setq rcirc-last-connect-time now)
|
||||
(rcirc-cmd-reconnect nil))))
|
||||
(run-hook-with-args 'rcirc-sentinel-functions process sentinel))))
|
||||
|
@ -2794,7 +2795,7 @@ the only argument."
|
|||
(let* ((nick (nth 1 args))
|
||||
(idle-secs (string-to-number (nth 2 args)))
|
||||
(idle-string (format-seconds "%yy %dd %hh %mm %z%ss" idle-secs))
|
||||
(signon-time (encode-time (string-to-number (nth 3 args))))
|
||||
(signon-time (string-to-number (nth 3 args)))
|
||||
(signon-string (format-time-string "%c" signon-time))
|
||||
(message (format "%s idle for %s, signed on %s"
|
||||
nick idle-string signon-string)))
|
||||
|
@ -2815,8 +2816,7 @@ Not in rfc1459.txt"
|
|||
(with-current-buffer buffer
|
||||
(let ((setter (nth 2 args))
|
||||
(time (current-time-string
|
||||
(encode-time
|
||||
(string-to-number (cl-cadddr args))))))
|
||||
(string-to-number (cl-cadddr args)))))
|
||||
(rcirc-print process sender "TOPIC" (cadr args)
|
||||
(format "%s (%s on %s)" rcirc-topic setter time))))))
|
||||
|
||||
|
|
|
@ -128,8 +128,9 @@ Returns DEFAULT if not set."
|
|||
(and (consp value)
|
||||
(or (null remote-file-name-inhibit-cache)
|
||||
(and (integerp remote-file-name-inhibit-cache)
|
||||
(<= (tramp-time-diff (current-time) (car value))
|
||||
remote-file-name-inhibit-cache))
|
||||
(time-less-p nil
|
||||
(time-add (car value)
|
||||
remote-file-name-inhibit-cache)))
|
||||
(and (consp remote-file-name-inhibit-cache)
|
||||
(time-less-p
|
||||
remote-file-name-inhibit-cache (car value)))))
|
||||
|
|
|
@ -1635,9 +1635,9 @@ of."
|
|||
(tramp-compat-time-equal-p
|
||||
(tramp-compat-file-attribute-modification-time fa2)
|
||||
tramp-time-dont-know)))
|
||||
(> 0 (tramp-time-diff
|
||||
(tramp-compat-file-attribute-modification-time fa2)
|
||||
(tramp-compat-file-attribute-modification-time fa1)))
|
||||
(time-less-p
|
||||
(tramp-compat-file-attribute-modification-time fa2)
|
||||
(tramp-compat-file-attribute-modification-time fa1))
|
||||
;; If one of them is the dont-know value, then we can
|
||||
;; still try to run a shell command on the remote host.
|
||||
;; However, this only works if both files are Tramp
|
||||
|
@ -4784,9 +4784,9 @@ connection if a previous connection has died for some reason."
|
|||
(unless (or (process-live-p p)
|
||||
(not (tramp-file-name-equal-p
|
||||
vec (car tramp-current-connection)))
|
||||
(> (tramp-time-diff
|
||||
(current-time) (cdr tramp-current-connection))
|
||||
(or tramp-connection-min-time-diff 0)))
|
||||
(time-less-p
|
||||
(or tramp-connection-min-time-diff 0)
|
||||
(time-since (cdr tramp-current-connection))))
|
||||
(throw 'suppress 'suppress))
|
||||
|
||||
;; If too much time has passed since last command was sent, look
|
||||
|
@ -4797,11 +4797,10 @@ connection if a previous connection has died for some reason."
|
|||
;; try to send a command from time to time, then look again
|
||||
;; whether the process is really alive.
|
||||
(condition-case nil
|
||||
(when (and (> (tramp-time-diff
|
||||
(current-time)
|
||||
(tramp-get-connection-property
|
||||
p "last-cmd-time" '(0 0 0)))
|
||||
60)
|
||||
(when (and (time-less-p 60
|
||||
(time-since
|
||||
(tramp-get-connection-property
|
||||
p "last-cmd-time" 0)))
|
||||
(process-live-p p))
|
||||
(tramp-send-command vec "echo are you awake" t t)
|
||||
(unless (and (process-live-p p)
|
||||
|
|
|
@ -1900,11 +1900,10 @@ If ARGUMENT is non-nil, use it as argument for
|
|||
;; connection timeout.
|
||||
(with-current-buffer buf
|
||||
(goto-char (point-min))
|
||||
(when (and (> (tramp-time-diff
|
||||
(current-time)
|
||||
(tramp-get-connection-property
|
||||
p "last-cmd-time" '(0 0 0)))
|
||||
60)
|
||||
(when (and (time-less-p 60
|
||||
(time-since
|
||||
(tramp-get-connection-property
|
||||
p "last-cmd-time" 0)))
|
||||
(process-live-p p)
|
||||
(re-search-forward tramp-smb-errors nil t))
|
||||
(delete-process p)
|
||||
|
|
|
@ -228,8 +228,7 @@
|
|||
(let* ((start (current-time))
|
||||
(val (apply function args)))
|
||||
(message "%s ran in %g seconds"
|
||||
function
|
||||
(float-time (time-subtract nil start)))
|
||||
function (float-time (time-since start)))
|
||||
val))
|
||||
|
||||
(defun rng-time-tokenize-buffer ()
|
||||
|
|
|
@ -622,8 +622,7 @@ Return propertized STRING."
|
|||
(or (widget-get widget :tag) "")
|
||||
(format-time-string
|
||||
"%d %B %Y, %T"
|
||||
(encode-time
|
||||
(string-to-number (widget-get widget :xesam:sourceModified)))))))
|
||||
(string-to-number (widget-get widget :xesam:sourceModified))))))
|
||||
|
||||
;; Second line: :value.
|
||||
(widget-put widget :value (widget-get widget :xesam:url))
|
||||
|
|
|
@ -5867,12 +5867,12 @@ See also the user option `org-agenda-clock-consistency-checks'."
|
|||
((> dt (* 60 maxtime))
|
||||
;; a very long clocking chunk
|
||||
(setq issue (format "Clocking interval is very long: %s"
|
||||
(org-duration-from-minutes (floor (/ dt 60.))))
|
||||
(org-duration-from-minutes (floor dt 60)))
|
||||
face (or (plist-get pl :long-face) face)))
|
||||
((< dt (* 60 mintime))
|
||||
;; a very short clocking chunk
|
||||
(setq issue (format "Clocking interval is very short: %s"
|
||||
(org-duration-from-minutes (floor (/ dt 60.))))
|
||||
(org-duration-from-minutes (floor dt 60)))
|
||||
face (or (plist-get pl :short-face) face)))
|
||||
((and (> tlend 0) (< ts tlend))
|
||||
;; Two clock entries are overlapping
|
||||
|
@ -5912,8 +5912,8 @@ See also the user option `org-agenda-clock-consistency-checks'."
|
|||
(throw 'exit t))
|
||||
;; We have a shorter gap.
|
||||
;; Now we have to get the minute of the day when these times are
|
||||
(let* ((t1dec (decode-time (encode-time t1)))
|
||||
(t2dec (decode-time (encode-time t2)))
|
||||
(let* ((t1dec (decode-time t1))
|
||||
(t2dec (decode-time t2))
|
||||
;; compute the minute on the day
|
||||
(min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec))))
|
||||
(min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec)))))
|
||||
|
@ -10157,8 +10157,7 @@ to override `appt-message-warning-time'."
|
|||
;; Do not use `org-today' here because appt only takes
|
||||
;; time and without date as argument, so it may pass wrong
|
||||
;; information otherwise
|
||||
(today (org-date-to-gregorian
|
||||
(time-to-days (current-time))))
|
||||
(today (org-date-to-gregorian (time-to-days nil)))
|
||||
(org-agenda-restrict nil)
|
||||
(files (org-agenda-files 'unrestricted)) entries file
|
||||
(org-agenda-buffer nil))
|
||||
|
|
|
@ -1000,8 +1000,7 @@ Store them in the capture property list."
|
|||
(equal current-prefix-arg 1))
|
||||
;; Prompt for date.
|
||||
(let ((prompt-time (org-read-date
|
||||
nil t nil "Date for tree entry:"
|
||||
(current-time))))
|
||||
nil t nil "Date for tree entry:" nil)))
|
||||
(org-capture-put
|
||||
:default-time
|
||||
(cond ((and (or (not (boundp 'org-time-was-given))
|
||||
|
|
|
@ -723,7 +723,7 @@ menu\nmouse-2 will jump to task"))
|
|||
The time returned includes the time spent on this task in
|
||||
previous clocking intervals."
|
||||
(let ((currently-clocked-time
|
||||
(floor (encode-time (time-subtract nil org-clock-start-time) 'integer)
|
||||
(floor (encode-time (time-since org-clock-start-time) 'integer)
|
||||
60)))
|
||||
(+ currently-clocked-time (or org-clock-total-time 0))))
|
||||
|
||||
|
@ -932,7 +932,7 @@ If necessary, clock-out of the currently active clock."
|
|||
(unless (org-is-active-clock clock)
|
||||
(org-clock-clock-in clock t))))
|
||||
|
||||
((not (time-less-p resolve-to (current-time)))
|
||||
((not (time-less-p resolve-to nil))
|
||||
(error "RESOLVE-TO must refer to a time in the past"))
|
||||
|
||||
(t
|
||||
|
@ -1033,8 +1033,7 @@ to be CLOCKED OUT."))))
|
|||
nil 45)))
|
||||
(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
|
||||
(default
|
||||
(floor (encode-time (time-subtract (current-time) last-valid)
|
||||
'integer)
|
||||
(floor (encode-time (time-since last-valid) 'integer)
|
||||
60))
|
||||
(keep
|
||||
(and (memq ch '(?k ?K))
|
||||
|
@ -1043,8 +1042,9 @@ to be CLOCKED OUT."))))
|
|||
(and (memq ch '(?g ?G))
|
||||
(read-number "Got back how many minutes ago? " default)))
|
||||
(subtractp (memq ch '(?s ?S)))
|
||||
(barely-started-p (< (- (float-time last-valid)
|
||||
(float-time (cdr clock))) 45))
|
||||
(barely-started-p (time-less-p
|
||||
(time-subtract last-valid (cdr clock))
|
||||
45))
|
||||
(start-over (and subtractp barely-started-p)))
|
||||
(cond
|
||||
((memq ch '(?j ?J))
|
||||
|
@ -1070,10 +1070,9 @@ to be CLOCKED OUT."))))
|
|||
(and gotback (= gotback default)))
|
||||
'now)
|
||||
(keep
|
||||
(time-add last-valid (encode-time (* 60 keep))))
|
||||
(time-add last-valid (* 60 keep)))
|
||||
(gotback
|
||||
(time-subtract (current-time)
|
||||
(encode-time (* 60 gotback))))
|
||||
(time-since (* 60 gotback)))
|
||||
(t
|
||||
(error "Unexpected, please report this as a bug")))
|
||||
(and gotback last-valid)
|
||||
|
@ -1103,7 +1102,7 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
|
|||
(lambda (clock)
|
||||
(format
|
||||
"Dangling clock started %d mins ago"
|
||||
(floor (encode-time (time-subtract nil (cdr clock))
|
||||
(floor (encode-time (time-since (cdr clock))
|
||||
'integer)
|
||||
60)))))
|
||||
(or last-valid
|
||||
|
@ -1155,8 +1154,7 @@ so long."
|
|||
org-clock-marker (marker-buffer org-clock-marker))
|
||||
(let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
|
||||
(org-clock-user-idle-start
|
||||
(time-subtract (current-time)
|
||||
(encode-time org-clock-user-idle-seconds)))
|
||||
(time-since org-clock-user-idle-seconds))
|
||||
(org-clock-resolving-clocks-due-to-idleness t))
|
||||
(if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
|
||||
(org-clock-resolve
|
||||
|
@ -1165,9 +1163,8 @@ so long."
|
|||
(lambda (_)
|
||||
(format "Clocked in & idle for %.1f mins"
|
||||
(/ (float-time
|
||||
(time-subtract (current-time)
|
||||
org-clock-user-idle-start))
|
||||
60.0)))
|
||||
(time-since org-clock-user-idle-start))
|
||||
60)))
|
||||
org-clock-user-idle-start)))))
|
||||
|
||||
(defvar org-clock-current-task nil "Task currently clocked in.")
|
||||
|
@ -1324,9 +1321,11 @@ the default behavior."
|
|||
(y-or-n-p
|
||||
(format
|
||||
"You stopped another clock %d mins ago; start this one from then? "
|
||||
(/ (- (float-time
|
||||
(org-current-time org-clock-rounding-minutes t))
|
||||
(float-time leftover))
|
||||
(/ (encode-time
|
||||
(time-subtract
|
||||
(org-current-time org-clock-rounding-minutes t)
|
||||
leftover)
|
||||
'integer)
|
||||
60)))
|
||||
leftover)
|
||||
start-time
|
||||
|
@ -1577,19 +1576,19 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
|
|||
(delete-region (point) (point-at-eol))
|
||||
(insert "--")
|
||||
(setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
|
||||
(setq s (float-time (time-subtract
|
||||
(org-time-string-to-time te)
|
||||
(org-time-string-to-time ts)))
|
||||
(setq s (encode-time (time-subtract
|
||||
(org-time-string-to-time te)
|
||||
(org-time-string-to-time ts))
|
||||
'integer)
|
||||
h (floor s 3600)
|
||||
s (- s (* 3600 h))
|
||||
m (floor s 60))
|
||||
m (floor (mod s 3600) 60))
|
||||
(insert " => " (format "%2d:%02d" h m))
|
||||
(move-marker org-clock-marker nil)
|
||||
(move-marker org-clock-hd-marker nil)
|
||||
;; Possibly remove zero time clocks. However, do not add
|
||||
;; a note associated to the CLOCK line in this case.
|
||||
(cond ((and org-clock-out-remove-zero-time-clocks
|
||||
(= (+ h m) 0))
|
||||
(= 0 h m))
|
||||
(setq remove t)
|
||||
(delete-region (line-beginning-position)
|
||||
(line-beginning-position 2)))
|
||||
|
@ -1833,8 +1832,9 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
|
|||
tend
|
||||
(>= (float-time org-clock-start-time) tstart)
|
||||
(<= (float-time org-clock-start-time) tend))
|
||||
(let ((time (floor (- (float-time)
|
||||
(float-time org-clock-start-time))
|
||||
(let ((time (floor (encode-time
|
||||
(time-since org-clock-start-time)
|
||||
'integer)
|
||||
60)))
|
||||
(setq t1 (+ t1 time))))
|
||||
(let* ((headline-forced
|
||||
|
@ -2712,14 +2712,14 @@ LEVEL is an integer. Indent by two spaces per level above 1."
|
|||
(setq te (float-time (org-time-string-to-time te)))))
|
||||
(setq tsb
|
||||
(if (eq step0 'week)
|
||||
(let ((dow (nth 6 (decode-time (encode-time ts)))))
|
||||
(let ((dow (nth 6 (decode-time ts))))
|
||||
(if (<= dow ws) ts
|
||||
(- ts (* 86400 (- dow ws)))))
|
||||
ts))
|
||||
(while (< tsb te)
|
||||
(unless (bolp) (insert "\n"))
|
||||
(let ((start-time (max tsb ts)))
|
||||
(cl-incf tsb (let ((dow (nth 6 (decode-time (encode-time tsb)))))
|
||||
(cl-incf tsb (let ((dow (nth 6 (decode-time tsb))))
|
||||
(if (or (eq step0 'day)
|
||||
(= dow ws))
|
||||
step
|
||||
|
@ -2739,7 +2739,7 @@ LEVEL is an integer. Indent by two spaces per level above 1."
|
|||
:tstart (format-time-string (org-time-stamp-format t t)
|
||||
start-time)
|
||||
:tend (format-time-string (org-time-stamp-format t t)
|
||||
(encode-time (min te tsb))))))))
|
||||
(min te tsb)))))))
|
||||
(re-search-forward "^[ \t]*#\\+END:")
|
||||
(when (and stepskip0 (equal step-time 0))
|
||||
;; Remove the empty table
|
||||
|
|
|
@ -540,7 +540,7 @@ Where possible, use the standard interface for changing this line."
|
|||
(eol (line-end-position))
|
||||
(pom (or (get-text-property bol 'org-hd-marker) (point)))
|
||||
(key (or key (get-char-property (point) 'org-columns-key)))
|
||||
(org-columns--time (float-time (current-time)))
|
||||
(org-columns--time (float-time))
|
||||
(action
|
||||
(pcase key
|
||||
("CLOCKSUM"
|
||||
|
@ -790,7 +790,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
|
|||
(org-columns-goto-top-level)
|
||||
;; Initialize `org-columns-current-fmt' and
|
||||
;; `org-columns-current-fmt-compiled'.
|
||||
(let ((org-columns--time (float-time (current-time))))
|
||||
(let ((org-columns--time (float-time)))
|
||||
(org-columns-get-format columns-fmt-string)
|
||||
(unless org-columns-inhibit-recalculation (org-columns-compute-all))
|
||||
(save-excursion
|
||||
|
@ -1494,7 +1494,7 @@ PARAMS is a property list of parameters:
|
|||
(if (markerp org-columns-begin-marker)
|
||||
(move-marker org-columns-begin-marker (point))
|
||||
(setq org-columns-begin-marker (point-marker)))
|
||||
(let* ((org-columns--time (float-time (current-time)))
|
||||
(let* ((org-columns--time (float-time))
|
||||
(fmt
|
||||
(cond
|
||||
((bound-and-true-p org-agenda-overriding-columns-format))
|
||||
|
|
|
@ -317,11 +317,10 @@ When optional argument CANONICAL is non-nil, ignore
|
|||
Raise an error if expected format is unknown."
|
||||
(pcase (or fmt org-duration-format)
|
||||
(`h:mm
|
||||
(let ((minutes (floor minutes)))
|
||||
(format "%d:%02d" (/ minutes 60) (mod minutes 60))))
|
||||
(format "%d:%02d" (/ minutes 60) (mod minutes 60)))
|
||||
(`h:mm:ss
|
||||
(let* ((whole-minutes (floor minutes))
|
||||
(seconds (floor (* 60 (- minutes whole-minutes)))))
|
||||
(seconds (mod (* 60 minutes) 60)))
|
||||
(format "%s:%02d"
|
||||
(org-duration-from-minutes whole-minutes 'h:mm)
|
||||
seconds)))
|
||||
|
@ -402,9 +401,7 @@ Raise an error if expected format is unknown."
|
|||
(pcase-let* ((`(,unit . ,required?) units)
|
||||
(modifier (org-duration--modifier unit canonical)))
|
||||
(cond ((<= modifier minutes)
|
||||
(let ((value (if (integerp modifier)
|
||||
(/ (floor minutes) modifier)
|
||||
(floor (/ minutes modifier)))))
|
||||
(let ((value (floor minutes modifier)))
|
||||
(cl-decf minutes (* value modifier))
|
||||
(format " %d%s" value unit)))
|
||||
(required? (concat " 0" unit))
|
||||
|
|
|
@ -4765,13 +4765,13 @@ you want to help debugging the issue.")
|
|||
(defvar org-element-cache-sync-idle-time 0.6
|
||||
"Length, in seconds, of idle time before syncing cache.")
|
||||
|
||||
(defvar org-element-cache-sync-duration (encode-time 0.04)
|
||||
(defvar org-element-cache-sync-duration 0.04
|
||||
"Maximum duration, as a time value, for a cache synchronization.
|
||||
If the synchronization is not over after this delay, the process
|
||||
pauses and resumes after `org-element-cache-sync-break'
|
||||
seconds.")
|
||||
|
||||
(defvar org-element-cache-sync-break (encode-time 0.3)
|
||||
(defvar org-element-cache-sync-break 0.3
|
||||
"Duration, as a time value, of the pause between synchronizations.
|
||||
See `org-element-cache-sync-duration' for more information.")
|
||||
|
||||
|
@ -5066,7 +5066,7 @@ Assume ELEMENT belongs to cache and that a cache is active."
|
|||
TIME-LIMIT is a time value or nil."
|
||||
(and time-limit
|
||||
(or (input-pending-p)
|
||||
(time-less-p time-limit (current-time)))))
|
||||
(time-less-p time-limit nil))))
|
||||
|
||||
(defsubst org-element--cache-shift-positions (element offset &optional props)
|
||||
"Shift ELEMENT properties relative to buffer positions by OFFSET.
|
||||
|
@ -5120,8 +5120,7 @@ updated before current modification are actually submitted."
|
|||
(and next (aref next 0))
|
||||
threshold
|
||||
(and (not threshold)
|
||||
(time-add (current-time)
|
||||
org-element-cache-sync-duration))
|
||||
(time-add nil org-element-cache-sync-duration))
|
||||
future-change)
|
||||
;; Request processed. Merge current and next offsets and
|
||||
;; transfer ending position.
|
||||
|
|
|
@ -288,7 +288,7 @@ Habits are assigned colors on the following basis:
|
|||
(deadline (if scheduled-days
|
||||
(+ scheduled-days (- d-repeat s-repeat))
|
||||
(org-habit-deadline habit)))
|
||||
(m-days (or now-days (time-to-days (current-time)))))
|
||||
(m-days (or now-days (time-to-days nil))))
|
||||
(cond
|
||||
((< m-days scheduled)
|
||||
'(org-habit-clear-face . org-habit-clear-future-face))
|
||||
|
@ -406,8 +406,7 @@ current time."
|
|||
"Insert consistency graph for any habitual tasks."
|
||||
(let ((inhibit-read-only t)
|
||||
(buffer-invisibility-spec '(org-link))
|
||||
(moment (time-subtract (current-time)
|
||||
(list 0 (* 3600 org-extend-today-until) 0))))
|
||||
(moment (time-since (* 3600 org-extend-today-until))))
|
||||
(save-excursion
|
||||
(goto-char (if line (point-at-bol) (point-min)))
|
||||
(while (not (eobp))
|
||||
|
|
|
@ -332,7 +332,7 @@ stopped."
|
|||
(let* ((case-fold-search t)
|
||||
(limited-re (org-get-limited-outline-regexp))
|
||||
(level (or (org-current-level) 0))
|
||||
(time-limit (and delay (time-add (current-time) delay))))
|
||||
(time-limit (and delay (time-add nil delay))))
|
||||
;; For each line, set `line-prefix' and `wrap-prefix'
|
||||
;; properties depending on the type of line (headline, inline
|
||||
;; task, item or other).
|
||||
|
@ -345,7 +345,7 @@ stopped."
|
|||
;; In asynchronous mode, take a break of
|
||||
;; `org-indent-agent-resume-delay' every DELAY to avoid
|
||||
;; blocking any other idle timer or process output.
|
||||
((and delay (time-less-p time-limit (current-time)))
|
||||
((and delay (time-less-p time-limit nil))
|
||||
(setq org-indent-agent-resume-timer
|
||||
(run-with-idle-timer
|
||||
(time-add (current-idle-time) org-indent-agent-resume-delay)
|
||||
|
|
|
@ -2175,8 +2175,8 @@ If NLAST is a number, only the NLAST fields will actually be summed."
|
|||
(sres (if (= org-timecnt 0)
|
||||
(number-to-string res)
|
||||
(setq diff (* 3600 res)
|
||||
h (floor (/ diff 3600)) diff (mod diff 3600)
|
||||
m (floor (/ diff 60)) diff (mod diff 60)
|
||||
h (floor diff 3600) diff (mod diff 3600)
|
||||
m (floor diff 60) diff (mod diff 60)
|
||||
s diff)
|
||||
(format "%.0f:%02.0f:%02.0f" h m s))))
|
||||
(kill-new sres)
|
||||
|
|
|
@ -139,12 +139,7 @@ the region 0:00:00."
|
|||
(format "Restart timer with offset [%s]: " def)))
|
||||
(unless (string-match "\\S-" s) (setq s def))
|
||||
(setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
|
||||
(setq org-timer-start-time
|
||||
(encode-time
|
||||
;; Pass `current-time' result to `float-time' (instead
|
||||
;; of calling without arguments) so that only
|
||||
;; `current-time' has to be overridden in tests.
|
||||
(- (float-time (current-time)) delta))))
|
||||
(setq org-timer-start-time (time-since delta)))
|
||||
(setq org-timer-pause-time nil)
|
||||
(org-timer-set-mode-line 'on)
|
||||
(message "Timer start time set to %s, current value is %s"
|
||||
|
@ -167,14 +162,9 @@ With prefix arg STOP, stop it entirely."
|
|||
(setq org-timer-countdown-timer
|
||||
(org-timer--run-countdown-timer
|
||||
new-secs org-timer-countdown-timer-title))
|
||||
(setq org-timer-start-time
|
||||
(time-add (current-time) (encode-time new-secs))))
|
||||
(setq org-timer-start-time (time-add nil new-secs)))
|
||||
(setq org-timer-start-time
|
||||
;; Pass `current-time' result to `float-time' (instead
|
||||
;; of calling without arguments) so that only
|
||||
;; `current-time' has to be overridden in tests.
|
||||
(encode-time (- (float-time (current-time))
|
||||
(- pause-secs start-secs)))))
|
||||
(time-since (- pause-secs start-secs))))
|
||||
(setq org-timer-pause-time nil)
|
||||
(org-timer-set-mode-line 'on)
|
||||
(run-hooks 'org-timer-continue-hook)
|
||||
|
@ -233,14 +223,9 @@ it in the buffer."
|
|||
(abs (floor (org-timer-seconds))))))
|
||||
|
||||
(defun org-timer-seconds ()
|
||||
;; Pass `current-time' result to `float-time' (instead of calling
|
||||
;; without arguments) so that only `current-time' has to be
|
||||
;; overridden in tests.
|
||||
(if org-timer-countdown-timer
|
||||
(- (float-time org-timer-start-time)
|
||||
(float-time (or org-timer-pause-time (current-time))))
|
||||
(- (float-time (or org-timer-pause-time (current-time)))
|
||||
(float-time org-timer-start-time))))
|
||||
(let ((s (float-time (time-subtract org-timer-pause-time
|
||||
org-timer-start-time))))
|
||||
(if org-timer-countdown-timer (- s) s)))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-timer-change-times-in-region (beg end delta)
|
||||
|
@ -400,7 +385,7 @@ VALUE can be `on', `off', or `paused'."
|
|||
(message "No timer set")
|
||||
(let* ((rtime (decode-time
|
||||
(time-subtract (timer--time org-timer-countdown-timer)
|
||||
(current-time))))
|
||||
nil)))
|
||||
(rsecs (nth 0 rtime))
|
||||
(rmins (nth 1 rtime)))
|
||||
(message "%d minute(s) %d seconds left before next time out"
|
||||
|
@ -463,8 +448,7 @@ using three `C-u' prefix arguments."
|
|||
(org-timer--run-countdown-timer
|
||||
secs org-timer-countdown-timer-title))
|
||||
(run-hooks 'org-timer-set-hook)
|
||||
(setq org-timer-start-time
|
||||
(time-add (current-time) (encode-time secs)))
|
||||
(setq org-timer-start-time (time-add nil secs))
|
||||
(setq org-timer-pause-time nil)
|
||||
(org-timer-set-mode-line 'on))))))
|
||||
|
||||
|
|
|
@ -229,10 +229,10 @@ file to byte-code before it is loaded."
|
|||
(interactive "fFile to load: \nP")
|
||||
(let* ((age (lambda (file)
|
||||
(float-time
|
||||
(time-subtract (current-time)
|
||||
(file-attribute-modification-time
|
||||
(or (file-attributes (file-truename file))
|
||||
(file-attributes file)))))))
|
||||
(time-since
|
||||
(file-attribute-modification-time
|
||||
(or (file-attributes (file-truename file))
|
||||
(file-attributes file)))))))
|
||||
(base-name (file-name-sans-extension file))
|
||||
(exported-file (concat base-name ".el")))
|
||||
;; tangle if the Org file is newer than the elisp file
|
||||
|
@ -5626,8 +5626,7 @@ the rounding returns a past time."
|
|||
(defun org-today ()
|
||||
"Return today date, considering `org-extend-today-until'."
|
||||
(time-to-days
|
||||
(time-subtract (current-time)
|
||||
(list 0 (* 3600 org-extend-today-until) 0))))
|
||||
(time-since (* 3600 org-extend-today-until))))
|
||||
|
||||
;;;; Font-Lock stuff, including the activators
|
||||
|
||||
|
@ -13110,8 +13109,7 @@ This function is run automatically after each state change to a DONE state."
|
|||
(while (re-search-forward org-clock-line-re end t)
|
||||
(when (org-at-clock-log-p) (throw :clock t))))))
|
||||
(org-entry-put nil "LAST_REPEAT" (format-time-string
|
||||
(org-time-stamp-format t t)
|
||||
(current-time))))
|
||||
(org-time-stamp-format t t))))
|
||||
(when org-log-repeat
|
||||
(if (or (memq 'org-add-log-note (default-value 'post-command-hook))
|
||||
(memq 'org-add-log-note post-command-hook))
|
||||
|
@ -13170,7 +13168,7 @@ has been set"
|
|||
(let ((nshiftmax 10)
|
||||
(nshift 0))
|
||||
(while (or (= nshift 0)
|
||||
(not (time-less-p (current-time) time)))
|
||||
(not (time-less-p nil time)))
|
||||
(when (= (cl-incf nshift) nshiftmax)
|
||||
(or (y-or-n-p
|
||||
(format "%d repeater intervals were not \
|
||||
|
@ -14666,8 +14664,8 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0."
|
|||
((stringp s)
|
||||
(condition-case nil
|
||||
(float-time (org-time-string-to-time s))
|
||||
(error 0.)))
|
||||
(t 0.)))
|
||||
(error 0)))
|
||||
(t 0)))
|
||||
|
||||
(defun org-time-today ()
|
||||
"Time in seconds today at 0:00.
|
||||
|
@ -16568,22 +16566,20 @@ non-nil."
|
|||
((org-at-timestamp-p 'lax) (match-string 0))))
|
||||
;; Default time is either the timestamp at point or today.
|
||||
;; When entering a range, only the range start is considered.
|
||||
(default-time (if (not ts) (current-time)
|
||||
(org-time-string-to-time ts)))
|
||||
(default-time (and ts (org-time-string-to-time ts)))
|
||||
(default-input (and ts (org-get-compact-tod ts)))
|
||||
(repeater (and ts
|
||||
(string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts)
|
||||
(match-string 0 ts)))
|
||||
org-time-was-given
|
||||
org-end-time-was-given
|
||||
(time
|
||||
(and (if (equal arg '(16)) (current-time)
|
||||
(time (if (equal arg '(16)) (current-time)
|
||||
;; Preserve `this-command' and `last-command'.
|
||||
(let ((this-command this-command)
|
||||
(last-command last-command))
|
||||
(org-read-date
|
||||
arg 'totime nil nil default-time default-input
|
||||
inactive))))))
|
||||
inactive)))))
|
||||
(cond
|
||||
((and ts
|
||||
(memq last-command '(org-time-stamp org-time-stamp-inactive))
|
||||
|
@ -16957,7 +16953,7 @@ user."
|
|||
(when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
|
||||
(setq ans "+0"))
|
||||
|
||||
(when (setq delta (org-read-date-get-relative ans (current-time) org-def))
|
||||
(when (setq delta (org-read-date-get-relative ans nil org-def))
|
||||
(setq ans (replace-match "" t t ans)
|
||||
deltan (car delta)
|
||||
deltaw (nth 1 delta)
|
||||
|
@ -17114,7 +17110,7 @@ user."
|
|||
; (when (and org-read-date-prefer-future
|
||||
; (not iso-year)
|
||||
; (< (calendar-absolute-from-gregorian iso-date)
|
||||
; (time-to-days (current-time))))
|
||||
; (time-to-days nil)))
|
||||
; (setq year (1+ year)
|
||||
; iso-date (calendar-gregorian-from-absolute
|
||||
; (calendar-iso-to-absolute
|
||||
|
@ -17308,7 +17304,7 @@ Don't touch the rest."
|
|||
If SECONDS is non-nil, return the difference in seconds."
|
||||
(let ((fdiff (if seconds #'float-time #'time-to-days)))
|
||||
(- (funcall fdiff (org-time-string-to-time timestamp-string))
|
||||
(funcall fdiff (current-time)))))
|
||||
(funcall fdiff nil))))
|
||||
|
||||
(defun org-deadline-close-p (timestamp-string &optional ndays)
|
||||
"Is the time in TIMESTAMP-STRING close to the current date?"
|
||||
|
@ -17490,10 +17486,8 @@ days in order to avoid rounding problems."
|
|||
(match-end (match-end 0))
|
||||
(time1 (org-time-string-to-time ts1))
|
||||
(time2 (org-time-string-to-time ts2))
|
||||
(t1 (float-time time1))
|
||||
(t2 (float-time time2))
|
||||
(diff (abs (- t2 t1)))
|
||||
(negative (< (- t2 t1) 0))
|
||||
(diff (abs (float-time (time-subtract time2 time1))))
|
||||
(negative (time-less-p time2 time1))
|
||||
;; (ys (floor (* 365 24 60 60)))
|
||||
(ds (* 24 60 60))
|
||||
(hs (* 60 60))
|
||||
|
@ -17504,14 +17498,14 @@ days in order to avoid rounding problems."
|
|||
(fh "%02d:%02d")
|
||||
y d h m align)
|
||||
(if havetime
|
||||
(setq ; y (floor (/ diff ys)) diff (mod diff ys)
|
||||
(setq ; y (floor diff ys) diff (mod diff ys)
|
||||
y 0
|
||||
d (floor (/ diff ds)) diff (mod diff ds)
|
||||
h (floor (/ diff hs)) diff (mod diff hs)
|
||||
m (floor (/ diff 60)))
|
||||
(setq ; y (floor (/ diff ys)) diff (mod diff ys)
|
||||
d (floor diff ds) diff (mod diff ds)
|
||||
h (floor diff hs) diff (mod diff hs)
|
||||
m (floor diff 60))
|
||||
(setq ; y (floor diff ys) diff (mod diff ys)
|
||||
y 0
|
||||
d (floor (+ (/ diff ds) 0.5))
|
||||
d (round diff ds)
|
||||
h 0 m 0))
|
||||
(if (not to-buffer)
|
||||
(message "%s" (org-make-tdiff-string y d h m))
|
||||
|
@ -17602,7 +17596,7 @@ signaled."
|
|||
YEAR is expanded into one of the 30 next years, if possible, or
|
||||
into a past one. Any year larger than 99 is returned unchanged."
|
||||
(if (>= year 100) year
|
||||
(let* ((current (string-to-number (format-time-string "%Y" (current-time))))
|
||||
(let* ((current (string-to-number (format-time-string "%Y")))
|
||||
(century (/ current 100))
|
||||
(offset (- year (% current 100))))
|
||||
(cond ((> offset 30) (+ (* (1- century) 100) year))
|
||||
|
@ -18122,7 +18116,7 @@ A prefix ARG can be used to force the current date."
|
|||
diff)
|
||||
(when (or (org-at-timestamp-p 'lax)
|
||||
(org-match-line (concat ".*" org-ts-regexp)))
|
||||
(let ((d1 (time-to-days (current-time)))
|
||||
(let ((d1 (time-to-days nil))
|
||||
(d2 (time-to-days (org-time-string-to-time (match-string 1)))))
|
||||
(setq diff (- d2 d1))))
|
||||
(calendar)
|
||||
|
|
|
@ -1348,7 +1348,7 @@ does not exist."
|
|||
(expand-file-name (or (file-symlink-p file) file)
|
||||
(file-name-directory file)))))
|
||||
(if (not attr) (error "No such file: \"%s\"" file)
|
||||
(floor (float-time (file-attribute-modification-time attr))))))
|
||||
(encode-time (file-attribute-modification-time attr) 'integer))))
|
||||
|
||||
|
||||
(provide 'ox-publish)
|
||||
|
|
|
@ -3252,7 +3252,7 @@ locally for the subtree through node properties."
|
|||
(let ((val (cond ((equal (car key) "DATE")
|
||||
(or (cdr key)
|
||||
(with-temp-buffer
|
||||
(org-insert-time-stamp (current-time)))))
|
||||
(org-insert-time-stamp nil))))
|
||||
((equal (car key) "TITLE")
|
||||
(or (let ((visited-file
|
||||
(buffer-file-name (buffer-base-buffer))))
|
||||
|
|
|
@ -97,10 +97,11 @@ When scrolling request is delivered soon after the previous one,
|
|||
user is in hurry. When the time since last scroll is larger than
|
||||
`pixel-dead-time', we are ready for another smooth scroll, and this
|
||||
function returns nil."
|
||||
(let* ((current-time (float-time))
|
||||
(scroll-in-rush-p (< (- current-time pixel-last-scroll-time)
|
||||
pixel-dead-time)))
|
||||
(setq pixel-last-scroll-time current-time)
|
||||
(let* ((now (current-time))
|
||||
(scroll-in-rush-p (time-less-p
|
||||
(time-subtract now pixel-last-scroll-time)
|
||||
pixel-dead-time)))
|
||||
(setq pixel-last-scroll-time (float-time now))
|
||||
scroll-in-rush-p))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -381,7 +381,7 @@ BITS must be of length nrings. Start at START-TIME."
|
|||
(cl-loop for elapsed = (- (float-time) start-time)
|
||||
while (< elapsed hanoi-move-period)
|
||||
with tick-period = (/ (float hanoi-move-period) total-ticks)
|
||||
for tick = (ceiling (/ elapsed tick-period)) do
|
||||
for tick = (ceiling elapsed tick-period) do
|
||||
(hanoi-ring-to-pos ring (funcall tick-to-pos tick))
|
||||
(hanoi-sit-for (- (* tick tick-period) elapsed)))
|
||||
(cl-loop for tick from 1 to total-ticks by 2 do
|
||||
|
|
|
@ -1348,7 +1348,7 @@ Prefix ARG controls sort order, see `proced-sort-interactive'."
|
|||
|
||||
(defun proced-format-time (time)
|
||||
"Format time interval TIME."
|
||||
(let* ((ftime (float-time time))
|
||||
(let* ((ftime (encode-time time 'integer))
|
||||
(days (truncate ftime 86400))
|
||||
(ftime (mod ftime 86400))
|
||||
(hours (truncate ftime 3600))
|
||||
|
|
|
@ -849,8 +849,8 @@ If that option is nil, don't prints messages.
|
|||
ARGS are the same as for `message'."
|
||||
(when cpp-message-min-time-interval
|
||||
(let ((time (current-time)))
|
||||
(when (>= (float-time (time-subtract time cpp-progress-time))
|
||||
cpp-message-min-time-interval)
|
||||
(unless (time-less-p cpp-message-min-time-interval
|
||||
(time-subtract time cpp-progress-time))
|
||||
(setq cpp-progress-time time)
|
||||
(apply 'message args)))))
|
||||
|
||||
|
|
|
@ -765,7 +765,8 @@ report applies to that region."
|
|||
(flymake-log :debug "backend %s reported %d diagnostics in %.2f second(s)"
|
||||
backend
|
||||
(length new-diags)
|
||||
(- (float-time) flymake-check-start-time)))
|
||||
(float-time
|
||||
(time-since flymake-check-start-time))))
|
||||
(when (and (get-buffer (flymake--diagnostics-buffer-name))
|
||||
(get-buffer-window (flymake--diagnostics-buffer-name))
|
||||
(null (cl-set-difference (flymake-running-backends)
|
||||
|
|
|
@ -2771,8 +2771,8 @@ Otherwise, use the current value of `process-mark'."
|
|||
(with-current-buffer (process-buffer process)
|
||||
(cl-loop with start-pos = (or start
|
||||
(marker-position (process-mark process)))
|
||||
with end-time = (+ (float-time) timeout)
|
||||
for time-left = (- end-time (float-time))
|
||||
with end-time = (time-add nil timeout)
|
||||
for time-left = (float-time (time-subtract end-time nil))
|
||||
do (goto-char (point-max))
|
||||
if (looking-back regexp start-pos) return t
|
||||
while (> time-left 0)
|
||||
|
|
|
@ -7393,7 +7393,7 @@ only-lines."
|
|||
"Update progress information."
|
||||
(when (and vhdl-progress-info (not noninteractive)
|
||||
(time-less-p vhdl-progress-interval
|
||||
(time-subtract nil (aref vhdl-progress-info 2))))
|
||||
(time-since (aref vhdl-progress-info 2))))
|
||||
(let ((delta (- (aref vhdl-progress-info 1)
|
||||
(aref vhdl-progress-info 0))))
|
||||
(message "%s... (%2d%%)" string
|
||||
|
@ -8143,7 +8143,7 @@ depending on parameter UPPER-CASE."
|
|||
(downcase-word -1)))
|
||||
(when (and count vhdl-progress-interval (not noninteractive)
|
||||
(time-less-p vhdl-progress-interval
|
||||
(time-subtract nil last-update)))
|
||||
(time-since last-update)))
|
||||
(message "Fixing case... (%2d%s)"
|
||||
(+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg)))
|
||||
"%")
|
||||
|
|
|
@ -837,7 +837,7 @@ updated again."
|
|||
(defmacro ses--time-check (format &rest args)
|
||||
"If `ses-start-time' is more than a second ago, call `message' with FORMAT
|
||||
and ARGS and reset `ses-start-time' to the current time."
|
||||
`(when (> (- (float-time) ses-start-time) 1.0)
|
||||
`(when (time-less-p 1 (time-since ses-start-time))
|
||||
(message ,format ,@args)
|
||||
(setq ses-start-time (float-time))))
|
||||
|
||||
|
|
|
@ -5041,7 +5041,7 @@ NEW-MESSAGE, if non-nil, sets a new message for the reporter."
|
|||
(enough-time-passed
|
||||
;; See if enough time has passed since the last update.
|
||||
(or (not update-time)
|
||||
(when (>= (float-time) update-time)
|
||||
(when (time-less-p update-time nil)
|
||||
;; Calculate time for the next update
|
||||
(aset parameters 0 (+ update-time (aref parameters 5)))))))
|
||||
(cond ((and min-value max-value)
|
||||
|
|
|
@ -767,13 +767,15 @@ Can be nil to mean \"no timeout\".")
|
|||
By not redisplaying right away for xterm queries, we can avoid
|
||||
unsightly flashing during initialization. Give up and redisplay
|
||||
anyway if we've been waiting a little while."
|
||||
(let ((start-time (float-time)))
|
||||
(let ((start-time (current-time)))
|
||||
(or (let ((inhibit-redisplay t))
|
||||
(read-event nil nil xterm-query-redisplay-timeout))
|
||||
(read-event nil nil
|
||||
(and xterm-query-timeout
|
||||
(max 0 (+ start-time xterm-query-timeout
|
||||
(- (float-time)))))))))
|
||||
(max 0 (float-time
|
||||
(time-subtract
|
||||
xterm-query-timeout
|
||||
(time-since start-time)))))))))
|
||||
|
||||
(defun xterm--query (query handlers &optional no-async)
|
||||
"Send QUERY string to the terminal and watch for a response.
|
||||
|
|
18
lisp/time.el
18
lisp/time.el
|
@ -434,16 +434,17 @@ update which can wait for the next redisplay."
|
|||
((and (stringp mail-spool-file)
|
||||
(or (null display-time-server-down-time)
|
||||
;; If have been down for 20 min, try again.
|
||||
(< 1200 (- (float-time now)
|
||||
display-time-server-down-time))))
|
||||
(let ((start-time (float-time)))
|
||||
(time-less-p 1200 (time-since
|
||||
display-time-server-down-time))))
|
||||
(let ((start-time (current-time)))
|
||||
(prog1
|
||||
(display-time-file-nonempty-p mail-spool-file)
|
||||
;; Record whether mail file is accessible.
|
||||
(setq display-time-server-down-time
|
||||
(let ((end-time (float-time)))
|
||||
(and (< 20 (- end-time start-time))
|
||||
end-time))))))))
|
||||
(let ((end-time (current-time)))
|
||||
(and (time-less-p 20 (time-subtract
|
||||
end-time start-time))
|
||||
(float-time end-time)))))))))
|
||||
(24-hours (substring time 11 13))
|
||||
(hour (string-to-number 24-hours))
|
||||
(12-hours (int-to-string (1+ (% (+ hour 11) 12))))
|
||||
|
@ -571,8 +572,9 @@ For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"."
|
|||
(interactive)
|
||||
(let ((str
|
||||
(format-seconds (or format "%Y, %D, %H, %M, %z%S")
|
||||
(float-time
|
||||
(time-subtract nil before-init-time)))))
|
||||
(encode-time
|
||||
(time-since before-init-time)
|
||||
'integer))))
|
||||
(if (called-interactively-p 'interactive)
|
||||
(message "%s" str)
|
||||
str)))
|
||||
|
|
|
@ -201,7 +201,8 @@ This might return nil if the event did not occur over a buffer."
|
|||
(defun tooltip-delay ()
|
||||
"Return the delay in seconds for the next tooltip."
|
||||
(if (and tooltip-hide-time
|
||||
(< (- (float-time) tooltip-hide-time) tooltip-recent-seconds))
|
||||
(time-less-p (time-since tooltip-hide-time)
|
||||
tooltip-recent-seconds))
|
||||
tooltip-short-delay
|
||||
tooltip-delay))
|
||||
|
||||
|
|
|
@ -460,8 +460,7 @@ the variable of the same name."
|
|||
))))))
|
||||
|
||||
(defun timep (time)
|
||||
"If TIME is in the format returned by `current-time' then
|
||||
return TIME, else return nil."
|
||||
"If TIME is a Lisp time value then return TIME, else return nil."
|
||||
(condition-case nil
|
||||
(and (float-time time) time)
|
||||
(error nil)))
|
||||
|
@ -481,8 +480,7 @@ return TIME, else return nil."
|
|||
|
||||
(defun type-break-get-previous-time ()
|
||||
"Get previous break time from `type-break-file-name'.
|
||||
Returns nil if the file is missing or if the time breaks with the
|
||||
`current-time' format."
|
||||
Return nil if the file is missing or if the time is not a Lisp time value."
|
||||
(let ((file (type-break-choose-file)))
|
||||
(if file
|
||||
(timep ;; returns expected format, else nil
|
||||
|
@ -808,7 +806,7 @@ this or ask the user to start one right now."
|
|||
((and (car type-break-keystroke-threshold)
|
||||
(< type-break-keystroke-count (car type-break-keystroke-threshold))))
|
||||
((> type-break-time-warning-count 0)
|
||||
(let ((timeleft (type-break-time-difference (current-time)
|
||||
(let ((timeleft (type-break-time-difference nil
|
||||
type-break-time-next-break)))
|
||||
(setq type-break-warning-countdown-string (number-to-string timeleft))
|
||||
(cond
|
||||
|
@ -905,8 +903,8 @@ Current keystroke count : %s"
|
|||
(current-time-string type-break-time-next-break)
|
||||
(type-break-format-time
|
||||
(type-break-time-difference
|
||||
(current-time)
|
||||
type-break-time-next-break)))
|
||||
nil
|
||||
type-break-time-next-break)))
|
||||
"none scheduled")
|
||||
(or (car type-break-keystroke-threshold) "none")
|
||||
(or (cdr type-break-keystroke-threshold) "none")
|
||||
|
@ -1090,7 +1088,7 @@ With optional non-nil ALL, force redisplay of all mode-lines."
|
|||
(erase-buffer)
|
||||
(setq elapsed (type-break-time-difference
|
||||
type-break-time-last-break
|
||||
(current-time)))
|
||||
nil))
|
||||
(let ((good-interval (or type-break-good-rest-interval
|
||||
type-break-good-break-interval)))
|
||||
(cond
|
||||
|
|
|
@ -205,7 +205,7 @@ If `url-standalone-mode' is non-nil, cached items never expire."
|
|||
(time-less-p
|
||||
(time-add
|
||||
cache-time
|
||||
(encode-time (or expire-time url-cache-expire-time)))
|
||||
(or expire-time url-cache-expire-time))
|
||||
nil)))))
|
||||
|
||||
(defun url-cache-prune-cache (&optional directory)
|
||||
|
@ -227,7 +227,7 @@ considered \"expired\"."
|
|||
((time-less-p
|
||||
(time-add
|
||||
(file-attribute-modification-time (file-attributes file))
|
||||
(encode-time url-cache-expire-time))
|
||||
url-cache-expire-time)
|
||||
now)
|
||||
(delete-file file)
|
||||
(setq deleted-files (1+ deleted-files))))))
|
||||
|
|
|
@ -105,11 +105,10 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead."
|
|||
;; away, make it expire a year from now
|
||||
(expires (format-time-string
|
||||
"%d %b %Y %T [GMT]"
|
||||
(encode-time
|
||||
(let ((s (string-to-number (nth 4 fields))))
|
||||
(if (and (= s 0) long-session)
|
||||
(encode-time (+ (* 365 24 60 60) (float-time)))
|
||||
s)))))
|
||||
(let ((s (string-to-number (nth 4 fields))))
|
||||
(if (and (zerop s) long-session)
|
||||
(time-add nil (* 365 24 60 60))
|
||||
s))))
|
||||
(key (nth 5 fields))
|
||||
(val (nth 6 fields)))
|
||||
(cl-incf n)
|
||||
|
|
|
@ -162,8 +162,8 @@ The variable `url-queue-timeout' sets a timeout."
|
|||
(dolist (job url-queue)
|
||||
;; Kill jobs that have lasted longer than the timeout.
|
||||
(when (and (url-queue-start-time job)
|
||||
(> (- (float-time) (url-queue-start-time job))
|
||||
url-queue-timeout))
|
||||
(time-less-p url-queue-timeout
|
||||
(time-since (url-queue-start-time job))))
|
||||
(push job dead-jobs)))
|
||||
(dolist (job dead-jobs)
|
||||
(url-queue-kill-job job)
|
||||
|
|
|
@ -259,8 +259,7 @@ how long to wait for a response before giving up."
|
|||
;; process output.
|
||||
(while (and (not retrieval-done)
|
||||
(or (not timeout)
|
||||
(< (float-time (time-subtract nil start-time))
|
||||
timeout)))
|
||||
(time-less-p (time-since start-time) timeout)))
|
||||
(url-debug 'retrieval
|
||||
"Spinning in url-retrieve-synchronously: %S (%S)"
|
||||
retrieval-done asynch-buffer)
|
||||
|
|
|
@ -1541,10 +1541,7 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
|
|||
"Create a stash with the current tree state."
|
||||
(interactive)
|
||||
(vc-git--call nil "stash" "save"
|
||||
(let ((ct (current-time)))
|
||||
(concat
|
||||
(format-time-string "Snapshot on %Y-%m-%d" ct)
|
||||
(format-time-string " at %H:%M" ct))))
|
||||
(format-time-string "Snapshot on %Y-%m-%d at %H:%M"))
|
||||
(vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" "stash@{0}")
|
||||
(vc-resynch-buffer (vc-git-root default-directory) t t))
|
||||
|
||||
|
|
|
@ -2011,7 +2011,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
|
|||
;; ;; Terminates man processing
|
||||
;; "Report formatting time."
|
||||
;; (message "Man formatting done in %s seconds"
|
||||
;; (float-time (time-subtract nil WoMan-Man-start-time))))
|
||||
;; (float-time (time-since WoMan-Man-start-time))))
|
||||
|
||||
|
||||
;;; Buffer handling:
|
||||
|
|
|
@ -243,11 +243,10 @@ which is the \"1006\" extension implemented in Xterm >= 277."
|
|||
(y (nth 2 click))
|
||||
;; Emulate timestamp information. This is accurate enough
|
||||
;; for default value of mouse-1-click-follows-link (450msec).
|
||||
(timestamp (truncate
|
||||
(* 1000
|
||||
(- (float-time)
|
||||
(or xt-mouse-epoch
|
||||
(setq xt-mouse-epoch (float-time)))))))
|
||||
(timestamp (if (not xt-mouse-epoch)
|
||||
(progn (setq xt-mouse-epoch (float-time)) 0)
|
||||
(car (encode-time (time-since xt-mouse-epoch)
|
||||
1000))))
|
||||
(w (window-at x y))
|
||||
(ltrb (window-edges w))
|
||||
(left (nth 0 ltrb))
|
||||
|
|
Loading…
Add table
Reference in a new issue