From: Lars Ingebrigtsen Date: Tue, 30 Jul 2019 11:03:22 +0000 (+0200) Subject: Use decoded time accessors in calc X-Git-Tag: emacs-27.0.90~1817^2~24 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=608832acc35420fc7140f73cd8e18f1a00f93ec6;p=emacs.git Use decoded time accessors in calc * lisp/calc/calc-forms.el (calc-time, math-this-year) (calcFunc-now): Use decoded time accessors. --- diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index eb1a8248cdf..d867ac1d47a 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el @@ -41,7 +41,9 @@ (calc-enter-result 0 "time" (list 'mod (list 'hms - (nth 2 time) (nth 1 time) (nth 0 time)) + (decoded-time-hour time) + (decoded-time-minute time) + (decoded-time-second 0 time)) (list 'hms 24 0 0)))))) (defun calc-to-hms (arg) @@ -523,7 +525,7 @@ in the Gregorian calendar and the remaining part determines the time." (defun math-this-year () - (nth 5 (decode-time))) + (decoded-time-year (decode-time))) (defun math-leap-year-p (year &optional julian) "Non-nil if YEAR is a leap year. @@ -1341,8 +1343,12 @@ as measured in the integer number of days before December 31, 1 BC (Gregorian)." (defun calcFunc-now (&optional zone) (let ((date (let ((now (decode-time))) (list 'date (math-dt-to-date - (list (nth 5 now) (nth 4 now) (nth 3 now) - (nth 2 now) (nth 1 now) (nth 0 now))))))) + (list (decoded-time-year now) + (decoded-time-month now) + (decoded-time-day now) + (decoded-time-hour now) + (decoded-time-minute now) + (decoded-time-second now))))))) (if zone (math-add date (math-div (math-sub (calcFunc-tzone nil date) (calcFunc-tzone zone date))