From: Stefan Monnier Date: Mon, 29 Jul 2019 15:57:49 +0000 (-0400) Subject: * lisp/simple.el (decoded-time): Use `cl-defstruct` X-Git-Tag: emacs-27.0.90~1817^2~32 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5483e44730d39284ca8fdfa360b92646bf23ba3c;p=emacs.git * lisp/simple.el (decoded-time): Use `cl-defstruct` --- diff --git a/lisp/simple.el b/lisp/simple.el index 8855045123f..0bc39f08c07 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9065,79 +9065,27 @@ to capitalize ARG words." ;;; Accessors for `decode-time' values. -(defsubst decoded-time-second (time) - "The seconds in TIME, which is a value returned by `decode-time'. +(cl-defstruct (decoded-time + (:constructor nil) + (:copier nil) + (:type list)) + (second nil :documentation "\ This is an integer between 0 and 60 (inclusive). (60 is a leap -second, which only some operating systems support.)" - (nth 0 time)) - -(defsubst decoded-time-minute (time) - "The minutes in TIME, which is a value returned by `decode-time'. -This is an integer between 0 and 59 (inclusive)." - (nth 1 time)) - -(defsubst decoded-time-hour (time) - "The hours in TIME, which is a value returned by `decode-time'. -This is an integer between 0 and 23 (inclusive)." - (nth 2 time)) - -(defsubst decoded-time-day (time) - "The day-of-the-month in TIME, which is a value returned by `decode-time'. -This is an integer between 1 and 31 (inclusive)." - (nth 3 time)) - -(defsubst decoded-time-month (time) - "The month in TIME, which is a value returned by `decode-time'. -This is an integer between 1 and 12 (inclusive). January is 1." - (nth 4 time)) - -(defsubst decoded-time-year (time) - "The year in TIME, which is a value returned by `decode-time'. -This is a four digit integer." - (nth 5 time)) - -(defsubst decoded-time-weekday (time) - "The day-of-the-week in TIME, which is a value returned by `decode-time'. -This is a number between 0 and 6, and 0 is Sunday." - (nth 6 time)) - -(defsubst decoded-time-dst (time) - "The daylight saving time in TIME, which is a value returned by `decode-time'. -This is t if daylight saving time is in effect, and nil if not." - (nth 7 time)) - -(defsubst decoded-time-zone (time) - "The time zone in TIME, which is a value returned by `decode-time'. +second, which only some operating systems support.)") + (minute nil :documentation "This is an integer between 0 and 59 (inclusive).") + (hour nil :documentation "This is an integer between 0 and 23 (inclusive).") + (day nil :documentation "This is an integer between 1 and 31 (inclusive).") + (month nil :documentation "\ +This is an integer between 1 and 12 (inclusive). January is 1.") + (year nil :documentation "This is a four digit integer.") + (weekday nil :documentation "\ +This is a number between 0 and 6, and 0 is Sunday.") + (dst nil :documentation "\ +This is t if daylight saving time is in effect, and nil if not.") + (zone nil :documentation "\ This is an integer indicating the UTC offset in seconds, i.e., -the number of seconds east of Greenwich." - (nth 8 time)) - -(gv-define-setter decoded-time-second (second time) - `(setf (nth 0 ,time) ,second)) - -(gv-define-setter decoded-time-minute (minute time) - `(setf (nth 1 ,time) ,minute)) - -(gv-define-setter decoded-time-hour (hour time) - `(setf (nth 2 ,time) ,hour)) - -(gv-define-setter decoded-time-day (day time) - `(setf (nth 3 ,time) ,day)) - -(gv-define-setter decoded-time-month (month time) - `(setf (nth 4 ,time) ,month)) - -(gv-define-setter decoded-time-year (year time) - `(setf (nth 5 ,time) ,year)) - -;; No setter for weekday, which is the 6th element. - -(gv-define-setter decoded-time-dst (dst time) - `(setf (nth 7 ,time) ,dst)) - -(gv-define-setter decoded-time-zone (zone time) - `(setf (nth 8 ,time) ,zone)) - +the number of seconds east of Greenwich.") + )