mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
decode-time now returns subsec too
The list that decode-time returns now contains an extra trailing component that counts the subseconds part of the original timestamp (Bug#36549). This builds on a suggestion by Lars Ingebrigtsen in: https://lists.gnu.org/r/emacs-devel/2019-07/msg00734.html * doc/lispref/os.texi (Time Conversion): * doc/misc/emacs-mime.texi (time-date): * etc/NEWS: Document this. * lisp/calendar/icalendar.el (icalendar--decode-isodatetime): * lisp/calendar/iso8601.el (iso8601-parse) (iso8601-parse-time, iso8601-parse-duration) (iso8601--decoded-time): * lisp/calendar/parse-time.el (parse-time-string): * lisp/calendar/time-date.el (make-decoded-time) (decoded-time-set-defaults): * lisp/org/org.el (org-fix-decoded-time) (org-parse-time-string): * src/timefns.c (Fdecode_time): Generate subsec member for decoded time. * lisp/calendar/time-date.el (decoded-time-add) Add the decoded subsec too. * lisp/simple.el (decoded-time): New subsec member. * src/data.c (Frem): Simplify zero-check to match that of new Fmod. (integer_mod): New function, with most of the guts of the old Fmod. Remove redundant zero-check. (Fmod): Use it. * src/timefns.c (Fencode_time): Handle new subsec member or (with the obsolescent calling convention) subsec arg. It defaults to 0. * test/lisp/calendar/icalendar-tests.el: (icalendar--decode-isodatetime): * test/lisp/calendar/iso8601-tests.el (test-iso8601-date-years) (test-iso8601-date-dates, test-iso8601-date-obsolete) (test-iso8601-date-weeks, test-iso8601-date-ordinals) (test-iso8601-time, test-iso8601-combined) (test-iso8601-duration, test-iso8601-intervals) (standard-test-dates, standard-test-time-of-day-fractions) (standard-test-time-of-day-beginning-of-day) (standard-test-time-of-day-utc) (standard-test-time-of-day-zone) (standard-test-date-and-time-of-day, standard-test-interval): * test/lisp/calendar/parse-time-tests.el (parse-time-tests): * test/src/timefns-tests.el (format-time-string-with-zone) (encode-time-dst-numeric-zone): Adjust to match new behavior.
This commit is contained in:
parent
89c63b3522
commit
b06917a491
17 changed files with 266 additions and 191 deletions
|
|
@ -17292,10 +17292,10 @@ The command returns the inserted time stamp."
|
|||
(put-text-property beg end 'display str)))
|
||||
|
||||
(defun org-fix-decoded-time (time)
|
||||
"Set 0 instead of nil for the first 6 elements of time.
|
||||
"Set 0 instead of nil for the time-related elements of time.
|
||||
Don't touch the rest."
|
||||
(let ((n 0))
|
||||
(mapcar (lambda (x) (if (< (setq n (1+ n)) 7) (or x 0) x)) time)))
|
||||
(mapcar (lambda (x) (if (or (< (setq n (1+ n)) 7) (= n 10)) (or x 0) x)) time)))
|
||||
|
||||
(defun org-time-stamp-to-now (timestamp-string &optional seconds)
|
||||
"Difference between TIMESTAMP-STRING and now in days.
|
||||
|
|
@ -17779,7 +17779,7 @@ NODEFAULT, hour and minute fields will be nil if not given."
|
|||
(string-to-number (match-string 4 s))
|
||||
(string-to-number (match-string 3 s))
|
||||
(string-to-number (match-string 2 s))
|
||||
nil nil nil))
|
||||
nil nil nil 0))
|
||||
((string-match "^<[^>]+>$" s)
|
||||
;; FIXME: `decode-time' needs to be called with ZONE as its
|
||||
;; second argument. However, this requires at least Emacs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue