emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r118228: Simplify use of current-time and friends.


From: Paul Eggert
Subject: [Emacs-diffs] trunk r118228: Simplify use of current-time and friends.
Date: Wed, 29 Oct 2014 01:42:59 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118228
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2014-10-28 18:42:51 -0700
message:
  Simplify use of current-time and friends.
  
  * doc/misc/org.texi (Dynamic blocks):
  * lisp/allout-widgets.el (allout-widgets-hook-error-handler):
  * lisp/calendar/appt.el (appt-display-message):
  * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical):
  * lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave)
  (timeclock-last-period, timeclock-day-base):
  * lisp/eshell/em-ls.el (eshell-ls-file):
  * lisp/eshell/esh-util.el (eshell-parse-ange-ls):
  * lisp/generic-x.el (named-database-print-serial):
  * lisp/net/newst-backend.el (newsticker--get-news-by-url-callback)
  (newsticker-get-news, newsticker--sentinel-work)
  (newsticker--image-get, newsticker--image-sentinel):
  * lisp/net/tramp-sh.el (tramp-get-remote-touch):
  * lisp/progmodes/opascal.el (opascal-debug-log):
  * lisp/textmodes/remember.el (remember-mail-date)
  (remember-store-in-files):
  * lisp/vc/vc-annotate.el (vc-annotate-display-autoscale)
  (vc-default-annotate-current-time):
  * lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot):
  * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time):
  * lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time):
  * lisp/url/url-util.el (url-get-normalized-date):
  * lisp/erc/erc-backend.el (TOPIC):
  * lisp/gnus/gnus-delay.el (gnus-delay-article):
  * lisp/gnus/gnus-sum.el (gnus-summary-read-document):
  * lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month):
  * lisp/gnus/message.el (message-make-expires-date):
  * lisp/org/org-archive.el (org-archive-subtree)
  (org-archive-to-archive-sibling):
  * lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start)
  (org-clock-special-range):
  * lisp/org/org-timer.el (org-timer-seconds):
  * lisp/org/org.el (org-read-date-analyze, org-get-cursor-date):
  * lisp/org/ox-html.el (org-html-format-spec):
  * lisp/org/ox-icalendar.el (org-icalendar--vtodo):
  Omit unnecessary call to current-time.
  * lisp/calendar/time-date.el (time-to-seconds) [!float-time]:
  * lisp/calendar/timeclock.el (timeclock-time-to-date):
  * lisp/vc/vc-annotate.el (vc-annotate-convert-time):
  Use current time if arg is nil, to be compatible with float-time.
  (time-date--day-in-year): New function, with most of the guts of
  the old time-to-day-in-year.
  (time-to-day-in-year): Use it.
  (time-to-days): Use it, to avoid decoding the same time stamp twice.
  * lisp/calendar/timeclock.el (timeclock-update-mode-line):
  * lisp/cedet/srecode/args.el (srecode-semantic-handle-:time):
  * lisp/gnus/gnus-util.el (gnus-seconds-year):
  * lisp/org/org.el (org-get-cursor-date):
  Don't call current-time twice to get the current time stamp,
  as this can lead to inconsistent results.
  * lisp/completion.el (cmpl-hours-since-origin):
  * lisp/erc/erc.el (erc-emacs-time-to-erc-time):
  * lisp/ido.el (ido-time-stamp):
  * lisp/vc/vc-annotate.el (vc-annotate-convert-time):
  Simplify by using float-time.
  * lisp/completion.el (save-completions-to-file):
  * lisp/url/url-cache.el (url-cache-prune-cache):
  Rename local var to avoid confusion.
  * lisp/gnus/gnus-util.el (gnus-float-time):
  * lisp/net/rcirc.el (rcirc-float-time):
  * lisp/org/org-compat.el (org-float-time):
  Simplify to an alias because time-to-seconds now behaves like float-time
  with respect to nil arg.
  * lisp/subr.el (progress-reporter-do-update):
  Don't call float-time unless needed.
  * lisp/erc/erc.el (erc-current-time): Simplify by using 
erc-emacs-time-to-erc-time.
  * lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy
  conversion from floating point to Emacs time and back.
  (org-resolve-clocks): Prefer two-argument floor.
modified:
  doc/misc/ChangeLog             changelog-20091113204419-o5vbwnq5f7feedwu-6331
  doc/misc/org.texi              org.texi-20091113204419-o5vbwnq5f7feedwu-6313
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/allout-widgets.el         
alloutwidgets.el-20110216214309-bmcqbuvdcly80khi-1
  lisp/calendar/appt.el          appt.el-20091113204419-o5vbwnq5f7feedwu-187
  lisp/calendar/icalendar.el     
icalendar.el-20091113204419-o5vbwnq5f7feedwu-3296
  lisp/calendar/time-date.el     
timedate.el-20091113204419-o5vbwnq5f7feedwu-2380
  lisp/calendar/timeclock.el     
timeclock.el-20091113204419-o5vbwnq5f7feedwu-1896
  lisp/cedet/ChangeLog           changelog-20100919015713-3rbr456yray5m84f-1
  lisp/cedet/srecode/args.el     args.el-20091113204419-o5vbwnq5f7feedwu-11320
  lisp/completion.el             
completion.el-20091113204419-o5vbwnq5f7feedwu-115
  lisp/erc/ChangeLog             changelog-20091113204419-o5vbwnq5f7feedwu-4305
  lisp/erc/erc-backend.el        
ercbackend.el-20091113204419-o5vbwnq5f7feedwu-4313
  lisp/erc/erc.el                erc.el-20091113204419-o5vbwnq5f7feedwu-4346
  lisp/eshell/em-ls.el           emls.el-20091113204419-o5vbwnq5f7feedwu-1858
  lisp/eshell/esh-util.el        eshutil.el-20091113204419-o5vbwnq5f7feedwu-1849
  lisp/generic-x.el              
genericx.el-20091113204419-o5vbwnq5f7feedwu-1268
  lisp/gnus/ChangeLog            changelog-20091113204419-o5vbwnq5f7feedwu-1433
  lisp/gnus/gnus-delay.el        
gnusdelay.el-20091113204419-o5vbwnq5f7feedwu-3240
  lisp/gnus/gnus-sum.el          gnussum.el-20091113204419-o5vbwnq5f7feedwu-1137
  lisp/gnus/gnus-util.el         
gnusutil.el-20091113204419-o5vbwnq5f7feedwu-1140
  lisp/gnus/message.el           message.el-20091113204419-o5vbwnq5f7feedwu-1145
  lisp/ido.el                    ido.el-20091113204419-o5vbwnq5f7feedwu-2430
  lisp/net/newst-backend.el      
newstbackend.el-20091113204419-o5vbwnq5f7feedwu-8682
  lisp/net/rcirc.el              rcirc.el-20091113204419-o5vbwnq5f7feedwu-4032
  lisp/net/tramp-sh.el           trampsh.el-20100913133439-a1faifh29eqoi4nh-1
  lisp/org/ChangeLog             changelog-20091113204419-o5vbwnq5f7feedwu-8688
  lisp/org/org-archive.el        
orgarchive.el-20091113204419-o5vbwnq5f7feedwu-8641
  lisp/org/org-clock.el          
orgclock.el-20091113204419-o5vbwnq5f7feedwu-8644
  lisp/org/org-compat.el         
orgcompat.el-20091113204419-o5vbwnq5f7feedwu-8646
  lisp/org/org-timer.el          
orgtimer.el-20091113204419-o5vbwnq5f7feedwu-8801
  lisp/org/org.el                org.el-20091113204419-o5vbwnq5f7feedwu-8617
  lisp/org/ox-html.el            oxhtml.el-20131112130502-8825zrk0dp6b9sq5-9
  lisp/org/ox-icalendar.el       
oxicalendar.el-20131112130502-8825zrk0dp6b9sq5-10
  lisp/progmodes/opascal.el      delphi.el-20091113204419-o5vbwnq5f7feedwu-1324
  lisp/subr.el                   subr.el-20091113204419-o5vbwnq5f7feedwu-151
  lisp/textmodes/remember.el     
remember.el-20091113204419-o5vbwnq5f7feedwu-7584
  lisp/url/ChangeLog             changelog-20091113204419-o5vbwnq5f7feedwu-3116
  lisp/url/url-cache.el          
urlcache.el-20091113204419-o5vbwnq5f7feedwu-2978
  lisp/url/url-util.el           urlutil.el-20091113204419-o5vbwnq5f7feedwu-3003
  lisp/vc/vc-annotate.el         
vcannotate.el-20091113204419-o5vbwnq5f7feedwu-8692
  lisp/vc/vc-bzr.el              vcbzr.el-20091113204419-o5vbwnq5f7feedwu-5055
  lisp/vc/vc-cvs.el              vccvs.el-20091113204419-o5vbwnq5f7feedwu-1927
  lisp/vc/vc-rcs.el              vcrcs.el-20091113204419-o5vbwnq5f7feedwu-1926
=== modified file 'doc/misc/ChangeLog'
--- a/doc/misc/ChangeLog        2014-10-29 00:37:37 +0000
+++ b/doc/misc/ChangeLog        2014-10-29 01:42:51 +0000
@@ -1,3 +1,9 @@
+2014-10-29  Paul Eggert  <address@hidden>
+
+       Simplify use of current-time and friends.
+       * org.texi (Dynamic blocks): Omit unnecessary call to current-time
+       in example.
+
 2014-10-28  Christopher Schmidt  <address@hidden>
 
        * calc.texi (Quick Calculator): Mention prefix argument of

=== modified file 'doc/misc/org.texi'
--- a/doc/misc/org.texi 2014-10-12 22:56:45 +0000
+++ b/doc/misc/org.texi 2014-10-29 01:42:51 +0000
@@ -13126,7 +13126,7 @@
 #+TEXINFO_PRINTED_TITLE: GNU Sample
 #+SUBTITLE: for version 2.0, last updated 4 March 2014
 
-* Copying 
+* Copying
   :PROPERTIES:
   :COPYING:  t
   :END:
@@ -17538,7 +17538,7 @@
 (defun org-dblock-write:block-update-time (params)
   (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
     (insert "Last block update at: "
-            (format-time-string fmt (current-time)))))
+            (format-time-string fmt))))
 @end lisp
 
 If you want to make sure that all dynamic blocks are always up-to-date,

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-10-29 01:37:16 +0000
+++ b/lisp/ChangeLog    2014-10-29 01:42:51 +0000
@@ -1,3 +1,50 @@
+2014-10-29  Paul Eggert  <address@hidden>
+
+       Simplify use of current-time and friends.
+       * allout-widgets.el (allout-widgets-hook-error-handler):
+       * calendar/appt.el (appt-display-message):
+       * calendar/icalendar.el (icalendar--convert-float-to-ical):
+       * calendar/timeclock.el (timeclock-in, timeclock-when-to-leave)
+       (timeclock-last-period, timeclock-day-base):
+       * eshell/em-ls.el (eshell-ls-file):
+       * eshell/esh-util.el (eshell-parse-ange-ls):
+       * generic-x.el (named-database-print-serial):
+       * net/newst-backend.el (newsticker--get-news-by-url-callback)
+       (newsticker-get-news, newsticker--sentinel-work)
+       (newsticker--image-get, newsticker--image-sentinel):
+       * net/tramp-sh.el (tramp-get-remote-touch):
+       * progmodes/opascal.el (opascal-debug-log):
+       * textmodes/remember.el (remember-mail-date)
+       (remember-store-in-files):
+       * vc/vc-annotate.el (vc-annotate-display-autoscale)
+       (vc-default-annotate-current-time):
+       * vc/vc-bzr.el (vc-bzr-shelve-snapshot):
+       * vc/vc-cvs.el (vc-cvs-annotate-current-time):
+       * vc/vc-rcs.el (vc-rcs-annotate-current-time):
+       Omit unnecessary call to current-time.
+       * calendar/time-date.el (time-to-seconds) [!float-time]:
+       * vc/vc-annotate.el (vc-annotate-convert-time):
+       Use current time if arg is nil, to be compatible with float-time.
+       (time-date--day-in-year): New function, with most of the guts of
+       the old time-to-day-in-year.
+       (time-to-day-in-year): Use it.
+       (time-to-days): Use it, to avoid decoding the same time stamp twice.
+       * calendar/timeclock.el (timeclock-time-to-date):
+       Arg is now optional, like current-time-string.
+       (timeclock-update-mode-line):
+       Don't call current-time twice to get the current time stamp,
+       as this can lead to inconsistent results.
+       * completion.el (cmpl-hours-since-origin):
+       * ido.el (ido-time-stamp):
+       * vc/vc-annotate.el (vc-annotate-convert-time):
+       Simplify by using float-time.
+       * completion.el (save-completions-to-file):
+       Rename local var to avoid confusion.
+       * net/rcirc.el (rcirc-float-time): Simplify to an alias because
+       time-to-seconds now behaves like float-time with respect to nil arg.
+       * subr.el (progress-reporter-do-update):
+       Don't call float-time unless needed.
+
 2014-10-29  Leo Liu  <address@hidden>
 
        * net/rcirc.el (rcirc-fill-column): Use function.

=== modified file 'lisp/allout-widgets.el'
--- a/lisp/allout-widgets.el    2014-05-01 23:55:25 +0000
+++ b/lisp/allout-widgets.el    2014-10-29 01:42:51 +0000
@@ -902,7 +902,7 @@
          (header
           (format "allout-widgets-last-hook-error stored, %s/%s %s %s"
                   this mode args
-                  (format-time-string "%e-%b-%Y %r" (current-time)))))
+                  (format-time-string "%e-%b-%Y %r"))))
     ;; post to *Messages* then immediately replace with more compact notice:
     (message "%s" (setq allout-widgets-last-hook-error
                         (format "%s:\n%s" header bt)))

=== modified file 'lisp/calendar/appt.el'
--- a/lisp/calendar/appt.el     2014-01-01 07:43:34 +0000
+++ b/lisp/calendar/appt.el     2014-10-29 01:42:51 +0000
@@ -228,7 +228,7 @@
              string (car string)))
   (cond ((eq appt-display-format 'window)
          ;; TODO use calendar-month-abbrev-array rather than %b?
-         (let ((time (format-time-string "%a %b %e " (current-time)))
+         (let ((time (format-time-string "%a %b %e "))
                err)
            (condition-case err
                (funcall appt-disp-window-function

=== modified file 'lisp/calendar/icalendar.el'
--- a/lisp/calendar/icalendar.el        2014-10-06 02:02:04 +0000
+++ b/lisp/calendar/icalendar.el        2014-10-29 01:42:51 +0000
@@ -1682,7 +1682,7 @@
           (cons (concat
                  ;;Start today (yes this is an arbitrary choice):
                  "\nDTSTART;VALUE=DATE:"
-                 (format-time-string "%Y%m%d" (current-time))
+                 (format-time-string "%Y%m%d")
                  ;;BUT remove today if `diary-float'
                  ;;expression does not hold true for today:
                  (when
@@ -1691,7 +1691,7 @@
                              (diary-float month dayname n)))
                    (concat
                     "\nEXDATE;VALUE=DATE:"
-                    (format-time-string "%Y%m%d" (current-time))))
+                    (format-time-string "%Y%m%d")))
                  "\nRRULE:"
                  (if (or (numberp month) (listp month))
                      "FREQ=YEARLY;BYMONTH="

=== modified file 'lisp/calendar/time-date.el'
--- a/lisp/calendar/time-date.el        2014-08-03 15:38:52 +0000
+++ b/lisp/calendar/time-date.el        2014-10-29 01:42:51 +0000
@@ -44,7 +44,7 @@
 
 Each element of the list VARLIST is a list of the form
 \(HIGH-SYMBOL LOW-SYMBOL MICRO-SYMBOL [PICO-SYMBOL [TYPE-SYMBOL]] TIME-VALUE).
-The time value TIME-VALUE is decoded and the result it bound to
+The time value TIME-VALUE is decoded and the result is bound to
 the symbols HIGH-SYMBOL, LOW-SYMBOL and MICRO-SYMBOL.
 The optional PICO-SYMBOL is bound to the picoseconds part.
 
@@ -147,10 +147,12 @@
   (or (featurep 'emacs)
       (and (fboundp 'float-time)
            (subrp (symbol-function 'float-time)))
-      (defun time-to-seconds (time)
-        "Convert time value TIME to a floating point number."
-        (with-decoded-time-value ((high low micro pico type time))
-          (+ (* 1.0 high 65536)
+      (defun time-to-seconds (&optional time)
+        "Convert optional value TIME to a floating point number.
+TIME defaults to the current time."
+        (with-decoded-time-value ((high low micro pico type
+                                  (or time (current-time))))
+          (+ (* high 65536.0)
              low
             (/ (+ (* micro 1e6) pico) 1e12))))))
 
@@ -272,11 +274,9 @@
           (not (zerop (% year 100))))
       (zerop (% year 400))))
 
-;;;###autoload
-(defun time-to-day-in-year (time)
-  "Return the day number within the year corresponding to TIME."
-  (let* ((tim (decode-time time))
-        (month (nth 4 tim))
+(defun time-date--day-in-year (tim)
+  "Return the day number within the year corresponding to the decoded time 
TIM."
+  (let* ((month (nth 4 tim))
         (day (nth 3 tim))
         (year (nth 5 tim))
         (day-of-year (+ day (* 31 (1- month)))))
@@ -287,13 +287,18 @@
     day-of-year))
 
 ;;;###autoload
+(defun time-to-day-in-year (time)
+  "Return the day number within the year corresponding to TIME."
+  (time-date--day-in-year (decode-time time)))
+
+;;;###autoload
 (defun time-to-days (time)
   "The number of days between the Gregorian date 0001-12-31bce and TIME.
 TIME should be a time value.
 The Gregorian date Sunday, December 31, 1bce is imaginary."
   (let* ((tim (decode-time time))
         (year (nth 5 tim)))
-    (+ (time-to-day-in-year time)      ;       Days this year
+    (+ (time-date--day-in-year tim)    ;       Days this year
        (* 365 (1- year))               ;       + Days in prior years
        (/ (1- year) 4)                 ;       + Julian leap years
        (- (/ (1- year) 100))           ;       - century years

=== modified file 'lisp/calendar/timeclock.el'
--- a/lisp/calendar/timeclock.el        2014-01-27 02:02:28 +0000
+++ b/lisp/calendar/timeclock.el        2014-10-29 01:42:51 +0000
@@ -320,7 +320,7 @@
       (cancel-timer timeclock-update-timer)
       (setq timeclock-update-timer nil))))
 
-(defsubst timeclock-time-to-date (time)
+(defsubst timeclock-time-to-date (&optional time)
   "Convert the TIME value to a textual date string."
   (format-time-string "%Y/%m/%d" time))
 
@@ -351,7 +351,7 @@
     (unless (and timeclock-last-event
                  (equal (timeclock-time-to-date
                          (cadr timeclock-last-event))
-                        (timeclock-time-to-date (current-time))))
+                        (timeclock-time-to-date)))
       (let ((workday (or (and (numberp arg) arg)
                         (and arg 0)
                         (and timeclock-get-workday-function
@@ -543,7 +543,7 @@
 If TODAY-ONLY is non-nil, the value returned will be relative only to
 the time worked today, and not to past time."
   (timeclock-seconds-to-time
-   (- (timeclock-time-to-seconds (current-time))
+   (- (timeclock-time-to-seconds)
       (let ((discrep (timeclock-find-discrep)))
        (if discrep
            (if today-only
@@ -647,14 +647,12 @@
         (if timeclock-use-elapsed
             (timeclock-workday-elapsed)
           (timeclock-workday-remaining (not timeclock-relative))))
-        (last-in (equal (car timeclock-last-event) "i")))
+       (last-in (equal (car timeclock-last-event) "i"))
+       (todays-date (timeclock-time-to-date)))
     (when (and (< remainder 0)
               (not (and timeclock-day-over
-                        (equal timeclock-day-over
-                               (timeclock-time-to-date
-                                (current-time))))))
-      (setq timeclock-day-over
-           (timeclock-time-to-date (current-time)))
+                        (equal timeclock-day-over todays-date))))
+      (setq timeclock-day-over todays-date)
       (run-hooks 'timeclock-day-over-hook))
     (setq timeclock-mode-string
           (propertize
@@ -725,9 +723,8 @@
 This is only provided for coherency when used by
 `timeclock-discrepancy'."
   (if (equal (car timeclock-last-event) "i")
-      (- (timeclock-time-to-seconds (or moment (current-time)))
-        (timeclock-time-to-seconds
-         (cadr timeclock-last-event)))
+      (- (timeclock-time-to-seconds moment)
+        (timeclock-time-to-seconds (cadr timeclock-last-event)))
     timeclock-last-period))
 
 (defsubst timeclock-entry-length (entry)
@@ -1156,7 +1153,7 @@
                             (+ timeclock-last-period timeclock-elapsed)))))
            (setq timeclock-last-event event
                  timeclock-last-event-workday
-                 (if (equal (timeclock-time-to-date now) last-date-limited)
+                 (if (equal todays-date last-date-limited)
                      last-date-seconds
                    timeclock-workday))
            (forward-line))
@@ -1182,7 +1179,7 @@
 (defun timeclock-day-base (&optional time)
   "Given a time within a day, return 0:0:0 within that day.
 If optional argument TIME is non-nil, use that instead of the current time."
-  (let ((decoded (decode-time (or time (current-time)))))
+  (let ((decoded (decode-time time)))
     (setcar (nthcdr 0 decoded) 0)
     (setcar (nthcdr 1 decoded) 0)
     (setcar (nthcdr 2 decoded) 0)

=== modified file 'lisp/cedet/ChangeLog'
--- a/lisp/cedet/ChangeLog      2014-10-24 04:09:55 +0000
+++ b/lisp/cedet/ChangeLog      2014-10-29 01:42:51 +0000
@@ -1,3 +1,10 @@
+2014-10-29  Paul Eggert  <address@hidden>
+
+       Simplify use of current-time and friends.
+       * srecode/args.el (srecode-semantic-handle-:time):
+       Don't call current-time twice to get the current time stamp,
+       as this can lead to inconsistent results.
+
 2014-10-24  Stefan Monnier  <address@hidden>
 
        * semantic/complete.el: Require semantic/db-find.

=== modified file 'lisp/cedet/srecode/args.el'
--- a/lisp/cedet/srecode/args.el        2014-01-01 07:43:34 +0000
+++ b/lisp/cedet/srecode/args.el        2014-10-29 01:42:51 +0000
@@ -101,35 +101,35 @@
 (defun srecode-semantic-handle-:time (dict)
   "Add macros into the dictionary DICT based on the current :time."
   ;; DATE Values
-  (srecode-dictionary-set-value
-   dict "YEAR" (format-time-string "%Y" (current-time)))
-  (srecode-dictionary-set-value
-   dict "MONTHNAME" (format-time-string "%B" (current-time)))
-  (srecode-dictionary-set-value
-   dict "MONTH" (format-time-string "%m" (current-time)))
-  (srecode-dictionary-set-value
-   dict "DAY" (format-time-string "%d" (current-time)))
-  (srecode-dictionary-set-value
-   dict "WEEKDAY" (format-time-string "%a" (current-time)))
-  ;; Time Values
-  (srecode-dictionary-set-value
-   dict "HOUR" (format-time-string "%H" (current-time)))
-  (srecode-dictionary-set-value
-   dict "HOUR12" (format-time-string "%l" (current-time)))
-  (srecode-dictionary-set-value
-   dict "AMPM" (format-time-string "%p" (current-time)))
-  (srecode-dictionary-set-value
-   dict "MINUTE" (format-time-string "%M" (current-time)))
-  (srecode-dictionary-set-value
-   dict "SECOND" (format-time-string "%S" (current-time)))
-  (srecode-dictionary-set-value
-   dict "TIMEZONE" (format-time-string "%Z" (current-time)))
-  ;; Convenience pre-packed date/time
-  (srecode-dictionary-set-value
-   dict "DATE" (format-time-string "%D" (current-time)))
-  (srecode-dictionary-set-value
-   dict "TIME" (format-time-string "%X" (current-time)))
-  )
+  (let ((now (current-time)))
+    (srecode-dictionary-set-value
+     dict "YEAR" (format-time-string "%Y" now))
+    (srecode-dictionary-set-value
+     dict "MONTHNAME" (format-time-string "%B" now))
+    (srecode-dictionary-set-value
+     dict "MONTH" (format-time-string "%m" now))
+    (srecode-dictionary-set-value
+     dict "DAY" (format-time-string "%d" now))
+    (srecode-dictionary-set-value
+     dict "WEEKDAY" (format-time-string "%a" now))
+    ;; Time Values
+    (srecode-dictionary-set-value
+     dict "HOUR" (format-time-string "%H" now))
+    (srecode-dictionary-set-value
+     dict "HOUR12" (format-time-string "%l" now))
+    (srecode-dictionary-set-value
+     dict "AMPM" (format-time-string "%p" now))
+    (srecode-dictionary-set-value
+     dict "MINUTE" (format-time-string "%M" now))
+    (srecode-dictionary-set-value
+     dict "SECOND" (format-time-string "%S" now))
+    (srecode-dictionary-set-value
+     dict "TIMEZONE" (format-time-string "%Z" now))
+    ;; Convenience pre-packed date/time
+    (srecode-dictionary-set-value
+     dict "DATE" (format-time-string "%D" now))
+    (srecode-dictionary-set-value
+     dict "TIME" (format-time-string "%X" now))))
 
 ;;; :file ARGUMENT HANDLING
 ;;

=== modified file 'lisp/completion.el'
--- a/lisp/completion.el        2014-02-10 01:34:22 +0000
+++ b/lisp/completion.el        2014-10-29 01:42:51 +0000
@@ -435,8 +435,7 @@
 
 
 (defun cmpl-hours-since-origin ()
-  (let ((time (current-time)))
-    (floor (+ (* 65536.0 (nth 0 time)) (nth 1 time)) 3600)))
+  (floor (float-time) 3600))
 
 ;;---------------------------------------------------------------------------
 ;; "Symbol" parsing functions
@@ -1950,7 +1949,7 @@
               (kept-old-versions 0)
               (kept-new-versions completions-file-versions-kept)
               last-use-time
-              (current-time (cmpl-hours-since-origin))
+              (this-use-time (cmpl-hours-since-origin))
               (total-in-db 0)
               (total-perm 0)
               (total-saved 0)
@@ -1982,13 +1981,13 @@
                      ;; or if
                      (if (> (completion-num-uses completion) 0)
                          ;; it's been used
-                         (setq last-use-time current-time)
+                         (setq last-use-time this-use-time)
                        ;; or it was saved before and
                        (and last-use-time
                             ;; save-completions-retention-time is nil
                             (or (not save-completions-retention-time)
                                 ;; or time since last use is < 
...retention-time*
-                                (< (- current-time last-use-time)
+                                (< (- this-use-time last-use-time)
                                    save-completions-retention-time)))))
                     ;; write to file
                     (setq total-saved (1+ total-saved))

=== modified file 'lisp/erc/ChangeLog'
--- a/lisp/erc/ChangeLog        2014-10-20 19:59:41 +0000
+++ b/lisp/erc/ChangeLog        2014-10-29 01:42:51 +0000
@@ -1,3 +1,10 @@
+2014-10-29  Paul Eggert  <address@hidden>
+
+       Simplify use of current-time and friends.
+       * erc-backend.el (TOPIC): Omit unnecessary call to current-time.
+       * erc.el (erc-emacs-time-to-erc-time): Simplify by using float-time.
+       (erc-current-time): Simplify by using erc-emacs-time-to-erc-time.
+
 2014-10-20  Glenn Morris  <address@hidden>
 
        * Merge in all changes up to 24.4 release.

=== modified file 'lisp/erc/erc-backend.el'
--- a/lisp/erc/erc-backend.el   2014-06-19 16:56:18 +0000
+++ b/lisp/erc/erc-backend.el   2014-10-29 01:42:51 +0000
@@ -1465,8 +1465,7 @@
   "The channel topic has changed." nil
   (let* ((ch (car (erc-response.command-args parsed)))
          (topic (erc-trim-string (erc-response.contents parsed)))
-         (time (format-time-string erc-server-timestamp-format
-                                   (current-time))))
+         (time (format-time-string erc-server-timestamp-format)))
     (pcase-let ((`(,nick ,login ,host)
                  (erc-parse-user (erc-response.sender parsed))))
       (erc-update-channel-member ch nick nick nil nil nil nil nil nil host 
login)

=== modified file 'lisp/erc/erc.el'
--- a/lisp/erc/erc.el   2014-10-10 16:53:19 +0000
+++ b/lisp/erc/erc.el   2014-10-29 01:42:51 +0000
@@ -5956,17 +5956,15 @@
     (list (truncate (/ n 65536))
           (truncate (mod n 65536)))))
 
-(defun erc-emacs-time-to-erc-time (time)
-  "Convert Emacs TIME to a number of seconds since the epoch."
-  (when time
-    (+ (* (nth 0 time) 65536.0) (nth 1 time))))
-;  (round (+ (* (nth 0 tm) 65536.0) (nth 1 tm))))
+(defalias 'erc-emacs-time-to-erc-time
+  (if (featurep 'xemacs) 'time-to-seconds 'float-time)
+  "Convert time value TIME to a floating point number.
+TIME defaults to the current time.")
 
-(defun erc-current-time ()
+(defalias 'erc-current-time 'erc-emacs-time-to-erc-time
   "Return the `current-time' as a number of seconds since the epoch.
 
-See also `erc-emacs-time-to-erc-time'."
-  (erc-emacs-time-to-erc-time (current-time)))
+See also `erc-emacs-time-to-erc-time'.")
 
 (defun erc-time-diff (t1 t2)
   "Return the time difference in seconds between T1 and T2."

=== modified file 'lisp/eshell/em-ls.el'
--- a/lisp/eshell/em-ls.el      2014-01-01 07:43:34 +0000
+++ b/lisp/eshell/em-ls.el      2014-10-29 01:42:51 +0000
@@ -490,7 +490,7 @@
                " " (format-time-string
                     (concat
                      eshell-ls-date-format " "
-                     (if (= (nth 5 (decode-time (current-time)))
+                     (if (= (nth 5 (decode-time))
                             (nth 5 (decode-time
                                     (nth (cond
                                           ((eq sort-method 'by-atime) 4)

=== modified file 'lisp/eshell/esh-util.el'
--- a/lisp/eshell/esh-util.el   2014-09-29 18:14:08 +0000
+++ b/lisp/eshell/esh-util.el   2014-10-29 01:42:51 +0000
@@ -653,7 +653,7 @@
                                   (match-string 6))))
                      (if (nth 0 moment)
                          (setcar (nthcdr 5 moment)
-                                 (nth 5 (decode-time (current-time))))
+                                 (nth 5 (decode-time)))
                        (setcar (nthcdr 0 moment) 0)
                        (setcar (nthcdr 1 moment) 0)
                        (setcar (nthcdr 2 moment) 0))

=== modified file 'lisp/generic-x.el'
--- a/lisp/generic-x.el 2014-01-01 07:43:34 +0000
+++ b/lisp/generic-x.el 2014-10-29 01:42:51 +0000
@@ -1650,7 +1650,7 @@
 (defun named-database-print-serial ()
   "Print a serial number based on the current date."
   (interactive)
-  (insert (format-time-string named-database-time-string (current-time)))))
+  (insert (format-time-string named-database-time-string))))
 
 (when (memq 'resolve-conf-generic-mode generic-extras-enable-list)
 

=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2014-10-27 03:51:18 +0000
+++ b/lisp/gnus/ChangeLog       2014-10-29 01:42:51 +0000
@@ -1,3 +1,16 @@
+2014-10-29  Paul Eggert  <address@hidden>
+
+       Simplify use of current-time and friends.
+       * gnus-delay.el (gnus-delay-article):
+       * gnus-sum.el (gnus-summary-read-document):
+       * gnus-util.el (gnus-seconds-today, gnus-seconds-month):
+       * message.el (message-make-expires-date):
+       Omit unnecessary call to current-time.
+       * gnus-util.el (gnus-float-time): Simplify to an alias because
+       time-to-seconds now behaves like float-time with respect to nil arg.
+       (gnus-seconds-year): Don't call current-time twice to get the current
+       time stamp, as this can lead to inconsistent results.
+
 2014-10-27  Katsumi Yamaoka  <address@hidden>
 
        * gnus.el (gnus-mode-line-buffer-identification):

=== modified file 'lisp/gnus/gnus-delay.el'
--- a/lisp/gnus/gnus-delay.el   2014-10-04 23:55:04 +0000
+++ b/lisp/gnus/gnus-delay.el   2014-10-29 01:42:51 +0000
@@ -98,7 +98,7 @@
           (setq hour   (string-to-number (match-string 1 delay))
                 minute (string-to-number (match-string 2 delay)))
           ;; Use current time, except...
-          (setq deadline (apply 'vector (decode-time (current-time))))
+          (setq deadline (apply 'vector (decode-time)))
           ;; ... for minute and hour.
           (aset deadline 1 minute)
           (aset deadline 2 hour)

=== modified file 'lisp/gnus/gnus-sum.el'
--- a/lisp/gnus/gnus-sum.el     2014-08-14 11:31:23 +0000
+++ b/lisp/gnus/gnus-sum.el     2014-10-29 01:42:51 +0000
@@ -9333,7 +9333,7 @@
      ((gnus-group-read-ephemeral-group
        (setq vgroup (format
                     "nnvirtual:%s-%s" gnus-newsgroup-name
-                    (format-time-string "%Y%m%dT%H%M%S" (current-time))))
+                    (format-time-string "%Y%m%dT%H%M%S")))
        `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
        t
        (cons (current-buffer) 'summary)))

=== modified file 'lisp/gnus/gnus-util.el'
--- a/lisp/gnus/gnus-util.el    2014-07-22 06:37:31 +0000
+++ b/lisp/gnus/gnus-util.el    2014-10-29 01:42:51 +0000
@@ -313,14 +313,12 @@
 
 ;; Every version of Emacs Gnus supports has built-in float-time.
 ;; The featurep test silences an irritating compiler warning.
-(eval-and-compile
+(defalias 'gnus-float-time
   (if (or (featurep 'emacs)
          (fboundp 'float-time))
-      (defalias 'gnus-float-time 'float-time)
-    (defun gnus-float-time (&optional time)
-      "Convert time value TIME to a floating point number.
-TIME defaults to the current time."
-      (time-to-seconds (or time (current-time))))))
+      'float-time 'time-to-seconds)
+  "Convert time value TIME to a floating point number.
+TIME defaults to the current time.")
 
 ;;; Keymap macros.
 
@@ -389,19 +387,20 @@
 
 (defun gnus-seconds-today ()
   "Return the number of seconds passed today."
-  (let ((now (decode-time (current-time))))
+  (let ((now (decode-time)))
     (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600))))
 
 (defun gnus-seconds-month ()
   "Return the number of seconds passed this month."
-  (let ((now (decode-time (current-time))))
+  (let ((now (decode-time)))
     (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600)
        (* (- (car (nthcdr 3 now)) 1) 3600 24))))
 
 (defun gnus-seconds-year ()
   "Return the number of seconds passed this year."
-  (let ((now (decode-time (current-time)))
-       (days (format-time-string "%j" (current-time))))
+  (let* ((current (current-time))
+        (now (decode-time current))
+        (days (format-time-string "%j" current)))
     (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600)
        (* (- (string-to-number days) 1) 3600 24))))
 

=== modified file 'lisp/gnus/message.el'
--- a/lisp/gnus/message.el      2014-10-16 22:12:47 +0000
+++ b/lisp/gnus/message.el      2014-10-29 01:42:51 +0000
@@ -5550,7 +5550,7 @@
   "Make date string for the Expires header.  Expiry in DAYS days.
 
 In posting styles use `(\"Expires\" (make-expires-date 30))'."
-  (let* ((cur (decode-time (current-time)))
+  (let* ((cur (decode-time))
         (nday (+ days (nth 3 cur))))
     (setf (nth 3 cur) nday)
     (message-make-date (apply 'encode-time cur))))

=== modified file 'lisp/ido.el'
--- a/lisp/ido.el       2014-03-03 02:27:08 +0000
+++ b/lisp/ido.el       2014-10-29 01:42:51 +0000
@@ -1306,8 +1306,7 @@
 
 (defun ido-time-stamp (&optional time)
   ;; Time is a floating point number (fractions of 1 hour)
-  (setq time (or time (current-time)))
-  (/ (+ (* (car time) 65536.0) (car (cdr time))) 3600.0))
+  (/ (float-time time) 3600))
 
 (defun ido-cache-ftp-valid (&optional time)
   (and (numberp ido-cache-ftp-work-directory-time)

=== modified file 'lisp/net/newst-backend.el'
--- a/lisp/net/newst-backend.el 2014-10-20 19:47:51 +0000
+++ b/lisp/net/newst-backend.el 2014-10-29 01:42:51 +0000
@@ -757,7 +757,7 @@
                )
               ((eq status-type :error)
                (message "%s: Error while retrieving news from %s: %s: \"%s\""
-                        (format-time-string "%A, %H:%M" (current-time))
+                        (format-time-string "%A, %H:%M")
                         feed-name
                         (car status-details) (cdr status-details))))))))
 
@@ -787,7 +787,7 @@
 FEED-NAME must be a string which occurs as the label (i.e. the first element)
 in an element of `newsticker-url-list' or `newsticker-url-list-defaults'."
   (newsticker--debug-msg "%s: Getting news for %s"
-                         (format-time-string "%A, %H:%M" (current-time))
+                         (format-time-string "%A, %H:%M")
                          feed-name)
   (let* ((item (or (assoc feed-name newsticker-url-list)
                    (assoc feed-name newsticker-url-list-defaults)
@@ -845,14 +845,14 @@
                 (concat "%s: Newsticker could not retrieve news from %s.\n"
                         "Return status: `%s'\n"
                         "Command was `%s'")
-                (format-time-string "%A, %H:%M" (current-time))
+                (format-time-string "%A, %H:%M")
                 feed-name event command)
                ""
                (current-time)
                'new
                0 nil))
         (message "%s: Error while retrieving news from %s"
-                 (format-time-string "%A, %H:%M" (current-time))
+                 (format-time-string "%A, %H:%M")
                  feed-name)
         (throw 'oops nil))
       (let* ((coding-system 'utf-8)
@@ -1020,7 +1020,7 @@
 
 (defun newsticker--do-xml-workarounds ()
   "Fix all issues which `xml-parse-region' could be choking on."
-  
+
   ;; a very very dirty workaround to overcome the
   ;; problems with the newest (20030621) xml.el:
   ;; remove all unnecessary whitespace
@@ -1808,11 +1808,11 @@
                           (time-add (nth 5 (file-attributes image-name))
                                     (seconds-to-time 86400))))
         (newsticker--debug-msg "%s: Getting image for %s skipped"
-                               (format-time-string "%A, %H:%M" (current-time))
+                               (format-time-string "%A, %H:%M")
                                feed-name)
       ;; download
       (newsticker--debug-msg "%s: Getting image for %s"
-                             (format-time-string "%A, %H:%M" (current-time))
+                             (format-time-string "%A, %H:%M")
                              feed-name)
       (if (eq newsticker-retrieval-method 'intern)
           (newsticker--image-download-by-url feed-name filename directory url)
@@ -1859,7 +1859,7 @@
       (unless (and (eq p-status 'exit)
                    (= exit-status 0))
         (message "%s: Error while retrieving image from %s"
-                 (format-time-string "%A, %H:%M" (current-time))
+                 (format-time-string "%A, %H:%M")
                  feed-name)
         (newsticker--image-remove directory feed-name)
         (throw 'oops nil))

=== modified file 'lisp/net/rcirc.el'
--- a/lisp/net/rcirc.el 2014-10-29 01:37:16 +0000
+++ b/lisp/net/rcirc.el 2014-10-29 01:42:51 +0000
@@ -599,10 +599,10 @@
   `(with-current-buffer rcirc-server-buffer
      ,@body))
 
-(defun rcirc-float-time ()
+(defalias 'rcirc-float-time
   (if (featurep 'xemacs)
-      (time-to-seconds (current-time))
-    (float-time)))
+      'time-to-seconds
+    'float-time))
 
 (defun rcirc-prompt-for-encryption (server-plist)
   "Prompt the user for the encryption method to use.

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2014-10-14 11:59:16 +0000
+++ b/lisp/net/tramp-sh.el      2014-10-29 01:42:51 +0000
@@ -5213,7 +5213,7 @@
          (format
           "%s -t %s %s"
           result
-          (format-time-string "%Y%m%d%H%M.%S" (current-time))
+          (format-time-string "%Y%m%d%H%M.%S")
           (tramp-file-name-handler 'file-remote-p tmpfile 'localname))))
        (delete-file tmpfile))
       result)))

=== modified file 'lisp/org/ChangeLog'
--- a/lisp/org/ChangeLog        2014-10-23 01:38:59 +0000
+++ b/lisp/org/ChangeLog        2014-10-29 01:42:51 +0000
@@ -1,3 +1,24 @@
+2014-10-29  Paul Eggert  <address@hidden>
+
+       Simplify use of current-time and friends.
+       * org-archive.el (org-archive-subtree)
+       (org-archive-to-archive-sibling):
+       * org-clock.el (org-resolve-clocks, org-clock-get-sum-start)
+       (org-clock-special-range):
+       * org-timer.el (org-timer-seconds):
+       * org.el (org-read-date-analyze, org-get-cursor-date):
+       * ox-html.el (org-html-format-spec):
+       * ox-icalendar.el (org-icalendar--vtodo):
+       Omit unnecessary call to current-time.
+       * org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy
+       conversion from floating point to Emacs time and back.
+       (org-resolve-clocks): Prefer two-argument floor.
+       * org-compat.el (org-float-time): Simplify to an alias because
+       time-to-seconds now behaves like float-time with respect to nil arg.
+       * org.el (org-get-cursor-date):
+       Don't call current-time twice to get the current time stamp,
+       as this can lead to inconsistent results.
+
 2014-10-20  Glenn Morris  <address@hidden>
 
        * Merge in all changes up to 24.4 release.

=== modified file 'lisp/org/org-archive.el'
--- a/lisp/org/org-archive.el   2014-01-01 07:43:34 +0000
+++ b/lisp/org/org-archive.el   2014-10-29 01:42:51 +0000
@@ -231,8 +231,7 @@
                       (error "No file associated to buffer"))))
            (olpath (mapconcat 'identity (org-get-outline-path) "/"))
            (time (format-time-string
-                  (substring (cdr org-time-stamp-formats) 1 -1)
-                  (current-time)))
+                  (substring (cdr org-time-stamp-formats) 1 -1)))
            category todo priority ltags itags atags
            ;; end of variables that will be used for saving context
            location afile heading buffer level newfile-p infile-p visiting
@@ -441,8 +440,7 @@
        (org-set-property
         "ARCHIVE_TIME"
         (format-time-string
-         (substring (cdr org-time-stamp-formats) 1 -1)
-         (current-time)))
+         (substring (cdr org-time-stamp-formats) 1 -1)))
        (outline-up-heading 1 t)
        (hide-subtree)
        (org-cycle-show-empty-lines 'folded)

=== modified file 'lisp/org/org-clock.el'
--- a/lisp/org/org-clock.el     2014-10-03 15:44:46 +0000
+++ b/lisp/org/org-clock.el     2014-10-29 01:42:51 +0000
@@ -1046,9 +1046,9 @@
                        (lambda (clock)
                          (format
                           "Dangling clock started %d mins ago"
-                          (floor
-                           (/ (- (org-float-time (current-time))
-                                 (org-float-time (cdr clock))) 60))))))
+                          (floor (- (org-float-time)
+                                    (org-float-time (cdr clock)))
+                                 60)))))
                   (or last-valid
                       (cdr clock)))))))))))
 
@@ -1368,7 +1368,7 @@
       (current-time))
      ((equal cmt "today")
       (setq org--msg-extra "showing today's task time.")
-      (let* ((dt (decode-time (current-time))))
+      (let* ((dt (decode-time)))
        (setq dt (append (list 0 0 0) (nthcdr 3 dt)))
        (if org-extend-today-until
            (setf (nth 2 dt) org-extend-today-until))
@@ -2029,7 +2029,7 @@
 month (1 is the first day of the month).
 If you can combine both, the month starting day will have priority."
   (if (integerp key) (setq key (intern (number-to-string key))))
-  (let* ((tm (decode-time (or time (current-time))))
+  (let* ((tm (decode-time time))
         (s 0) (m (nth 1 tm)) (h (nth 2 tm))
         (d (nth 3 tm)) (month (nth 4 tm)) (y (nth 5 tm))
         (dow (nth 6 tm))
@@ -2670,10 +2670,8 @@
     (when (and te (listp te))
       (setq te (format "%4d-%02d-%02d" (nth 2 te) (car te) (nth 1 te))))
     ;; Now the times are strings we can parse.
-    (if ts (setq ts (org-float-time
-                    (seconds-to-time (org-matcher-time ts)))))
-    (if te (setq te (org-float-time
-                    (seconds-to-time (org-matcher-time te)))))
+    (if ts (setq ts (org-matcher-time ts)))
+    (if te (setq te (org-matcher-time te)))
     (save-excursion
       (org-clock-sum ts te
                     (unless (null matcher)

=== modified file 'lisp/org/org-compat.el'
--- a/lisp/org/org-compat.el    2014-10-03 15:44:46 +0000
+++ b/lisp/org/org-compat.el    2014-10-29 01:42:51 +0000
@@ -411,12 +411,10 @@
         (when focus-follows-mouse
           (set-mouse-position frame (1- (frame-width frame)) 0)))))
 
-(defun org-float-time (&optional time)
+(defalias 'org-float-time
+  (if (featurep 'xemacs) 'time-to-seconds 'float-time)
   "Convert time value TIME to a floating point number.
-TIME defaults to the current time."
-  (if (featurep 'xemacs)
-      (time-to-seconds (or time (current-time)))
-    (float-time time)))
+TIME defaults to the current time.")
 
 ;; `user-error' is only available from 24.2.50 on
 (unless (fboundp 'user-error)

=== modified file 'lisp/org/org-timer.el'
--- a/lisp/org/org-timer.el     2014-10-03 08:13:51 +0000
+++ b/lisp/org/org-timer.el     2014-10-29 01:42:51 +0000
@@ -195,8 +195,8 @@
 (defun org-timer-seconds ()
   (if org-timer-timer-is-countdown
       (- (org-float-time org-timer-start-time)
-        (org-float-time (current-time)))
-    (- (org-float-time (or org-timer-pause-time (current-time)))
+        (org-float-time))
+    (- (org-float-time org-timer-pause-time)
        (org-float-time org-timer-start-time))))
 
 ;;;###autoload

=== modified file 'lisp/org/org.el'
--- a/lisp/org/org.el   2014-10-12 22:56:45 +0000
+++ b/lisp/org/org.el   2014-10-29 01:42:51 +0000
@@ -16490,7 +16490,7 @@
 (defun org-read-date-analyze (ans org-def org-defdecode)
   "Analyze the combined answer of the date prompt."
   ;; FIXME: cleanup and comment
-  (let ((nowdecode (decode-time (current-time)))
+  (let ((nowdecode (decode-time))
        delta deltan deltaw deltadef year month day
        hour minute second wday pm h2 m2 tl wday1
        iso-year iso-weekday iso-week iso-year iso-date futurep kill-year)
@@ -16648,7 +16648,7 @@
      (deltan
       (setq futurep nil)
       (unless deltadef
-       (let ((now (decode-time (current-time))))
+       (let ((now (decode-time)))
          (setq day (nth 3 now) month (nth 4 now) year (nth 5 now))))
       (cond ((member deltaw '("d" "")) (setq day (+ day deltan)))
            ((equal deltaw "w") (setq day (+ day (* 7 deltan))))
@@ -22062,8 +22062,9 @@
       (when (and tp (string-match "\\([0-9][0-9]\\):\\([0-9][0-9]\\)" tp))
        (setq hod (string-to-number (match-string 1 tp))
              mod (string-to-number (match-string 2 tp))))
-      (or tp (setq hod (nth 2 (decode-time (current-time)))
-                  mod (nth 1 (decode-time (current-time))))))
+      (or tp (let ((now (decode-time)))
+              (setq hod (nth 2 now)
+                    mod (nth 1 now)))))
     (cond
      ((eq major-mode 'calendar-mode)
       (setq date (calendar-cursor-to-date)

=== modified file 'lisp/org/ox-html.el'
--- a/lisp/org/ox-html.el       2014-10-03 15:44:46 +0000
+++ b/lisp/org/ox-html.el       2014-10-29 01:42:51 +0000
@@ -1630,8 +1630,7 @@
     (?c . ,(plist-get info :creator))
     (?C . ,(let ((file (plist-get info :input-file)))
             (format-time-string org-html-metadata-timestamp-format
-                                (if file (nth 5 (file-attributes file))
-                                  (current-time)))))
+                                (if file (nth 5 (file-attributes file))))))
     (?v . ,(or org-html-validation-link ""))))
 
 (defun org-html--build-pre/postamble (type info)

=== modified file 'lisp/org/ox-icalendar.el'
--- a/lisp/org/ox-icalendar.el  2014-10-03 08:13:51 +0000
+++ b/lisp/org/ox-icalendar.el  2014-10-29 01:42:51 +0000
@@ -678,7 +678,7 @@
                        (org-element-property :scheduled entry))
                   ;; If we can't use a scheduled time for some
                   ;; reason, start task now.
-                  (let ((now (decode-time (current-time))))
+                  (let ((now (decode-time)))
                     (list 'timestamp
                           (list :type 'active
                                 :minute-start (nth 1 now)

=== modified file 'lisp/progmodes/opascal.el'
--- a/lisp/progmodes/opascal.el 2014-03-14 00:22:33 +0000
+++ b/lisp/progmodes/opascal.el 2014-10-29 01:42:51 +0000
@@ -1397,7 +1397,7 @@
   (when opascal-debug
     (opascal-ensure-buffer opascal-debug-buffer "*OPascal Debug Log*")
     (opascal-log-msg opascal-debug-buffer
-                    (concat (format-time-string "%H:%M:%S " (current-time))
+                    (concat (format-time-string "%H:%M:%S ")
                             (apply #'format (cons format-string args))
                             "\n"))))
 

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2014-10-21 20:11:22 +0000
+++ b/lisp/subr.el      2014-10-29 01:42:51 +0000
@@ -4507,11 +4507,10 @@
         (min-value    (aref parameters 1))
         (max-value    (aref parameters 2))
         (text         (aref parameters 3))
-        (current-time (float-time))
         (enough-time-passed
          ;; See if enough time has passed since the last update.
          (or (not update-time)
-             (when (>= current-time update-time)
+             (when (>= (float-time) update-time)
                ;; Calculate time for the next update
                (aset parameters 0 (+ update-time (aref parameters 5)))))))
     (cond ((and min-value max-value)

=== modified file 'lisp/textmodes/remember.el'
--- a/lisp/textmodes/remember.el        2014-10-06 02:02:04 +0000
+++ b/lisp/textmodes/remember.el        2014-10-29 01:42:51 +0000
@@ -319,9 +319,7 @@
 
 (defsubst remember-mail-date (&optional rfc822-p)
   "Return a simple date.  Nothing fancy."
-  (if rfc822-p
-      (format-time-string "%a, %e %b %Y %T %z" (current-time))
-    (format-time-string "%a %b %e %T %Y" (current-time))))
+  (format-time-string (if rfc822-p "%a, %e %b %Y %T %z" "%a %b %e %T %Y")))
 
 (defun remember-buffer-desc ()
   "Using the first line of the current buffer, create a short description."
@@ -461,8 +459,7 @@
   "Store remember data in a file in `remember-data-directory'.
 The file is named by calling `format-time-string' using
 `remember-directory-file-name-format' as the format string."
-  (let ((name (format-time-string
-              remember-directory-file-name-format (current-time)))
+  (let ((name (format-time-string remember-directory-file-name-format))
         (text (buffer-string)))
     (with-temp-buffer
       (insert text)

=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog        2014-10-21 01:17:06 +0000
+++ b/lisp/url/ChangeLog        2014-10-29 01:42:51 +0000
@@ -1,3 +1,11 @@
+2014-10-29  Paul Eggert  <address@hidden>
+
+       Simplify use of current-time and friends.
+       * url-cache.el (url-cache-prune-cache):
+       Rename local var to avoid confusion.
+       * url-util.el (url-get-normalized-date):
+       Omit unnecessary call to current-time.
+
 2014-10-20  Glenn Morris  <address@hidden>
 
        * Merge in all changes up to 24.4 release.

=== modified file 'lisp/url/url-cache.el'
--- a/lisp/url/url-cache.el     2014-01-01 07:43:34 +0000
+++ b/lisp/url/url-cache.el     2014-10-29 01:42:51 +0000
@@ -212,7 +212,7 @@
   "Remove all expired files from the cache.
 `url-cache-expire-time' says how old a file has to be to be
 considered \"expired\"."
-  (let ((current-time (current-time))
+  (let ((now (current-time))
        (total-files 0)
        (deleted-files 0))
     (setq directory (or directory url-cache-directory))
@@ -228,7 +228,7 @@
             (time-add
              (nth 5 (file-attributes file))
              (seconds-to-time url-cache-expire-time))
-            current-time)
+            now)
            (delete-file file)
            (setq deleted-files (1+ deleted-files))))))
       (if (< deleted-files total-files)

=== modified file 'lisp/url/url-util.el'
--- a/lisp/url/url-util.el      2014-05-14 17:15:15 +0000
+++ b/lisp/url/url-util.el      2014-10-29 01:42:51 +0000
@@ -189,8 +189,7 @@
 (defun url-get-normalized-date (&optional specified-time)
  "Return a 'real' date string that most HTTP servers can understand."
  (let ((system-time-locale "C"))
-  (format-time-string "%a, %d %b %Y %T GMT"
-   (or specified-time (current-time)) t)))
+  (format-time-string "%a, %d %b %Y %T GMT" specified-time t)))
 
 ;;;###autoload
 (defun url-eat-trailing-space (x)

=== modified file 'lisp/vc/vc-annotate.el'
--- a/lisp/vc/vc-annotate.el    2014-09-29 18:14:08 +0000
+++ b/lisp/vc/vc-annotate.el    2014-10-29 01:42:51 +0000
@@ -253,7 +253,7 @@
   (interactive "P")
   (let ((newest 0.0)
        (oldest 999999.)                ;Any CVS users at the founding of Rome?
-       (current (vc-annotate-convert-time (current-time)))
+       (current (vc-annotate-convert-time))
        date)
     (message "Redisplaying annotation...")
     ;; Run through this file and find the oldest and newest dates annotated.
@@ -664,11 +664,10 @@
      (setq i (+ i 1)))
    tmp-cons))                          ; Return the appropriate value
 
-(defun vc-annotate-convert-time (time)
-  "Convert a time value to a floating-point number of days.
-The argument TIME is a list as returned by `current-time' or
-`encode-time', only the first two elements of that list are considered."
-  (/ (+ (* (float (car time)) (lsh 1 16)) (cadr time)) 24 3600))
+(defun vc-annotate-convert-time (&optional time)
+  "Convert optional value TIME to a floating-point number of days.
+TIME defaults to the current time."
+  (/ (float-time time) 86400))
 
 (defun vc-annotate-difference (&optional offset)
   "Return the time span in days to the next annotation.
@@ -683,7 +682,7 @@
 
 (defun vc-default-annotate-current-time (_backend)
   "Return the current time, encoded as fractional days."
-  (vc-annotate-convert-time (current-time)))
+  (vc-annotate-convert-time))
 
 (defvar vc-annotate-offset nil)
 

=== modified file 'lisp/vc/vc-bzr.el'
--- a/lisp/vc/vc-bzr.el 2014-07-21 01:25:59 +0000
+++ b/lisp/vc/vc-bzr.el 2014-10-29 01:42:51 +0000
@@ -1167,10 +1167,7 @@
   "Create a stash with the current tree state."
   (interactive)
   (vc-bzr-command "shelve" nil 0 nil "--all" "-m"
-                 (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-bzr-command "unshelve" nil 0 nil "--apply" "--keep")
   (vc-resynch-buffer (vc-bzr-root default-directory) t t))
 

=== modified file 'lisp/vc/vc-cvs.el'
--- a/lisp/vc/vc-cvs.el 2014-01-01 07:43:34 +0000
+++ b/lisp/vc/vc-cvs.el 2014-10-29 01:42:51 +0000
@@ -605,7 +605,7 @@
   "Return the current time, based at midnight of the current day, and
 encoded as fractional days."
   (vc-annotate-convert-time
-   (apply 'encode-time 0 0 0 (nthcdr 3 (decode-time (current-time))))))
+   (apply 'encode-time 0 0 0 (nthcdr 3 (decode-time)))))
 
 (defun vc-cvs-annotate-time ()
   "Return the time of the next annotation (as fraction of days)

=== modified file 'lisp/vc/vc-rcs.el'
--- a/lisp/vc/vc-rcs.el 2014-05-20 15:46:21 +0000
+++ b/lisp/vc/vc-rcs.el 2014-10-29 01:42:51 +0000
@@ -811,7 +811,7 @@
   "Return the current time, based at midnight of the current day, and
 encoded as fractional days."
   (vc-annotate-convert-time
-   (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time (current-time))))))
+   (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time)))))
 
 (defun vc-rcs-annotate-time ()
   "Return the time of the next annotation (as fraction of days)


reply via email to

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