diff options
| author | Lars Ingebrigtsen | 2019-07-30 13:03:22 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-30 13:03:22 +0200 |
| commit | 608832acc35420fc7140f73cd8e18f1a00f93ec6 (patch) | |
| tree | 22f5b8f3c5d2cd94bf23514affa86daa7392b63a | |
| parent | 3c4eb0d190ec5d28d5798b346fcde701fd919d1b (diff) | |
| download | emacs-608832acc35420fc7140f73cd8e18f1a00f93ec6.tar.gz emacs-608832acc35420fc7140f73cd8e18f1a00f93ec6.zip | |
Use decoded time accessors in calc
* lisp/calc/calc-forms.el (calc-time, math-this-year)
(calcFunc-now): Use decoded time accessors.
| -rw-r--r-- | lisp/calc/calc-forms.el | 14 |
1 files changed, 10 insertions, 4 deletions
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 @@ | |||
| 41 | (calc-enter-result 0 "time" | 41 | (calc-enter-result 0 "time" |
| 42 | (list 'mod | 42 | (list 'mod |
| 43 | (list 'hms | 43 | (list 'hms |
| 44 | (nth 2 time) (nth 1 time) (nth 0 time)) | 44 | (decoded-time-hour time) |
| 45 | (decoded-time-minute time) | ||
| 46 | (decoded-time-second 0 time)) | ||
| 45 | (list 'hms 24 0 0)))))) | 47 | (list 'hms 24 0 0)))))) |
| 46 | 48 | ||
| 47 | (defun calc-to-hms (arg) | 49 | (defun calc-to-hms (arg) |
| @@ -523,7 +525,7 @@ in the Gregorian calendar and the remaining part determines the time." | |||
| 523 | 525 | ||
| 524 | 526 | ||
| 525 | (defun math-this-year () | 527 | (defun math-this-year () |
| 526 | (nth 5 (decode-time))) | 528 | (decoded-time-year (decode-time))) |
| 527 | 529 | ||
| 528 | (defun math-leap-year-p (year &optional julian) | 530 | (defun math-leap-year-p (year &optional julian) |
| 529 | "Non-nil if YEAR is a leap year. | 531 | "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)." | |||
| 1341 | (defun calcFunc-now (&optional zone) | 1343 | (defun calcFunc-now (&optional zone) |
| 1342 | (let ((date (let ((now (decode-time))) | 1344 | (let ((date (let ((now (decode-time))) |
| 1343 | (list 'date (math-dt-to-date | 1345 | (list 'date (math-dt-to-date |
| 1344 | (list (nth 5 now) (nth 4 now) (nth 3 now) | 1346 | (list (decoded-time-year now) |
| 1345 | (nth 2 now) (nth 1 now) (nth 0 now))))))) | 1347 | (decoded-time-month now) |
| 1348 | (decoded-time-day now) | ||
| 1349 | (decoded-time-hour now) | ||
| 1350 | (decoded-time-minute now) | ||
| 1351 | (decoded-time-second now))))))) | ||
| 1346 | (if zone | 1352 | (if zone |
| 1347 | (math-add date (math-div (math-sub (calcFunc-tzone nil date) | 1353 | (math-add date (math-div (math-sub (calcFunc-tzone nil date) |
| 1348 | (calcFunc-tzone zone date)) | 1354 | (calcFunc-tzone zone date)) |