aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-07-29 11:57:49 -0400
committerStefan Monnier2019-07-29 11:57:49 -0400
commit5483e44730d39284ca8fdfa360b92646bf23ba3c (patch)
tree787f7689b0e47a6a02458275e4ceede11d3f93bb
parent75361be63fcd42497dd1eb93cab3255833334475 (diff)
downloademacs-5483e44730d39284ca8fdfa360b92646bf23ba3c.tar.gz
emacs-5483e44730d39284ca8fdfa360b92646bf23ba3c.zip
* lisp/simple.el (decoded-time): Use `cl-defstruct`
-rw-r--r--lisp/simple.el90
1 files changed, 19 insertions, 71 deletions
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."
9065 9065
9066;;; Accessors for `decode-time' values. 9066;;; Accessors for `decode-time' values.
9067 9067
9068(defsubst decoded-time-second (time) 9068(cl-defstruct (decoded-time
9069 "The seconds in TIME, which is a value returned by `decode-time'. 9069 (:constructor nil)
9070 (:copier nil)
9071 (:type list))
9072 (second nil :documentation "\
9070This is an integer between 0 and 60 (inclusive). (60 is a leap 9073This is an integer between 0 and 60 (inclusive). (60 is a leap
9071second, which only some operating systems support.)" 9074second, which only some operating systems support.)")
9072 (nth 0 time)) 9075 (minute nil :documentation "This is an integer between 0 and 59 (inclusive).")
9073 9076 (hour nil :documentation "This is an integer between 0 and 23 (inclusive).")
9074(defsubst decoded-time-minute (time) 9077 (day nil :documentation "This is an integer between 1 and 31 (inclusive).")
9075 "The minutes in TIME, which is a value returned by `decode-time'. 9078 (month nil :documentation "\
9076This is an integer between 0 and 59 (inclusive)." 9079This is an integer between 1 and 12 (inclusive). January is 1.")
9077 (nth 1 time)) 9080 (year nil :documentation "This is a four digit integer.")
9078 9081 (weekday nil :documentation "\
9079(defsubst decoded-time-hour (time) 9082This is a number between 0 and 6, and 0 is Sunday.")
9080 "The hours in TIME, which is a value returned by `decode-time'. 9083 (dst nil :documentation "\
9081This is an integer between 0 and 23 (inclusive)." 9084This is t if daylight saving time is in effect, and nil if not.")
9082 (nth 2 time)) 9085 (zone nil :documentation "\
9083
9084(defsubst decoded-time-day (time)
9085 "The day-of-the-month in TIME, which is a value returned by `decode-time'.
9086This is an integer between 1 and 31 (inclusive)."
9087 (nth 3 time))
9088
9089(defsubst decoded-time-month (time)
9090 "The month in TIME, which is a value returned by `decode-time'.
9091This is an integer between 1 and 12 (inclusive). January is 1."
9092 (nth 4 time))
9093
9094(defsubst decoded-time-year (time)
9095 "The year in TIME, which is a value returned by `decode-time'.
9096This is a four digit integer."
9097 (nth 5 time))
9098
9099(defsubst decoded-time-weekday (time)
9100 "The day-of-the-week in TIME, which is a value returned by `decode-time'.
9101This is a number between 0 and 6, and 0 is Sunday."
9102 (nth 6 time))
9103
9104(defsubst decoded-time-dst (time)
9105 "The daylight saving time in TIME, which is a value returned by `decode-time'.
9106This is t if daylight saving time is in effect, and nil if not."
9107 (nth 7 time))
9108
9109(defsubst decoded-time-zone (time)
9110 "The time zone in TIME, which is a value returned by `decode-time'.
9111This is an integer indicating the UTC offset in seconds, i.e., 9086This is an integer indicating the UTC offset in seconds, i.e.,
9112the number of seconds east of Greenwich." 9087the number of seconds east of Greenwich.")
9113 (nth 8 time)) 9088 )
9114
9115(gv-define-setter decoded-time-second (second time)
9116 `(setf (nth 0 ,time) ,second))
9117
9118(gv-define-setter decoded-time-minute (minute time)
9119 `(setf (nth 1 ,time) ,minute))
9120
9121(gv-define-setter decoded-time-hour (hour time)
9122 `(setf (nth 2 ,time) ,hour))
9123
9124(gv-define-setter decoded-time-day (day time)
9125 `(setf (nth 3 ,time) ,day))
9126
9127(gv-define-setter decoded-time-month (month time)
9128 `(setf (nth 4 ,time) ,month))
9129
9130(gv-define-setter decoded-time-year (year time)
9131 `(setf (nth 5 ,time) ,year))
9132
9133;; No setter for weekday, which is the 6th element.
9134
9135(gv-define-setter decoded-time-dst (dst time)
9136 `(setf (nth 7 ,time) ,dst))
9137
9138(gv-define-setter decoded-time-zone (zone time)
9139 `(setf (nth 8 ,time) ,zone))
9140
9141 9089
9142 9090
9143 9091