(let ((dtime (decode-time time)))
(concat
"Date: the "
- (number-to-string (nth 3 dtime))
- (let ((digit (% (nth 3 dtime) 10)))
+ (number-to-string (decoded-time-day dtime))
+ (let ((digit (% (decoded-time-day dtime) 10)))
(cond
- ((memq (nth 3 dtime) '(11 12 13)) "th")
+ ((memq (decoded-time-day dtime) '(11 12 13)) "th")
((= digit 1) "st")
((= digit 2) "nd")
((= digit 3) "rd")
(t "th")))
" of "
- (nth (1- (nth 4 dtime)) gnus-english-month-names)
+ (nth (1- (decoded-time-month dtime)) gnus-english-month-names)
" "
- (number-to-string (nth 5 dtime))
+ (number-to-string (decoded-time-year dtime))
" at "
- (format "%02d" (nth 2 dtime))
+ (format "%02d" (decoded-time-hour dtime))
":"
- (format "%02d" (nth 1 dtime)))))))
+ (format "%02d" (decoded-time-minute dtime)))))))
(foo
(format "Date: %s (from Gnus)" date))))
(thenHour (elt thenParts 2))
(thenMin (elt thenParts 1))
;; convert time as elements into number of seconds since EPOCH.
- (then (encode-time 0
- thenMin
- thenHour
- ;; If THEN is earlier than NOW, make it
- ;; same time tomorrow. Doc for encode-time
- ;; says that this is OK.
- (+ (elt nowParts 3)
- (if (or (< thenHour (elt nowParts 2))
- (and (= thenHour (elt nowParts 2))
- (<= thenMin (elt nowParts 1))))
- 1 0))
- (elt nowParts 4)
- (elt nowParts 5)
- (elt nowParts 6)
- (elt nowParts 7)
- (elt nowParts 8)))
+ (then (encode-time
+ 0
+ thenMin
+ thenHour
+ ;; If THEN is earlier than NOW, make it
+ ;; same time tomorrow. Doc for encode-time
+ ;; says that this is OK.
+ (+ (decoded-time-day nowParts)
+ (if (or (< thenHour (decoded-time-hour nowParts))
+ (and (= thenHour
+ (decoded-time-hour nowParts))
+ (<= thenMin
+ (decoded-time-minute nowParts))))
+ 1 0))
+ (decoded-time-month nowParts)
+ (decoded-time-year nowParts)
+ (decoded-time-weekday nowParts)
+ (decoded-time-dst nowParts)
+ (decoded-time-zone nowParts)))
(diff (float-time (time-subtract then now))))
;; Return number of timesteps in the number of seconds.
(round diff gnus-demon-timestep)))
(defun gnus-seconds-today ()
"Return the number of seconds passed today."
(let ((now (decode-time)))
- (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600))))
+ (+ (decoded-time-second now)
+ (* (decoded-time-minute now) 60)
+ (* (decoded-time-hour now) 3600))))
(defun gnus-seconds-month ()
"Return the number of seconds passed this month."
(let ((now (decode-time)))
- (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600)
- (* (- (car (nthcdr 3 now)) 1) 3600 24))))
+ (+ (decoded-time-second now)
+ (* (decoded-time-minute now) 60)
+ (* (decoded-time-hour now) 3600)
+ (* (- (decoded-time-day now) 1) 3600 24))))
(defun gnus-seconds-year ()
"Return the number of seconds passed this year."
(let* ((current (current-time))
(now (decode-time current))
(days (format-time-string "%j" current)))
- (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600)
+ (+ (decoded-time-second now)
+ (* (decoded-time-minute now) 60)
+ (* (decoded-time-hour now) 3600)
(* (- (string-to-number days) 1) 3600 24))))
(defmacro gnus-date-get-time (date)
In posting styles use `(\"Expires\" (make-expires-date 30))'."
(let* ((cur (decode-time))
- (nday (+ days (nth 3 cur))))
- (setf (nth 3 cur) nday)
+ (nday (+ days (decoded-time-day cur))))
+ (setf (decoded-time-day cur) nday)
(message-make-date (encode-time cur))))
(defun message-make-message-id ()
(date-elts (decode-time date))
;; ### NOTE: out-of-range values are accepted by encode-time. This
;; makes our life easier.
- (monday (- (nth 3 date-elts)
+ (monday (- (decoded-time-day date-elts)
(if nndiary-week-starts-on-monday
- (if (zerop (nth 6 date-elts))
+ (if (zerop (decoded-time-weekday date-elts))
6
- (- (nth 6 date-elts) 1))
- (nth 6 date-elts))))
+ (- (decoded-time-weekday date-elts) 1))
+ (decoded-time-weekday date-elts))))
reminder res)
;; remove the DOW and DST entries
(setcdr (nthcdr 5 date-elts) (nthcdr 8 date-elts))
;; have to know which day is the 1st one for this month.
;; Maybe there's simpler, but decode-time(encode-time) will
;; give us the answer.
- (let ((first (nth 6 (decode-time
- (encode-time 0 0 0 1 month year
- time-zone))))
+ (let ((first (decoded-time-weekday
+ (decode-time
+ (encode-time 0 0 0 1 month year
+ time-zone))))
(max (cond ((= month 2)
(if (date-leap-year-p year) 29 28))
((<= month 7)
;; If there's no next occurrence, returns the last one (if any) which is then
;; in the past.
(let* ((today (decode-time now))
- (this-minute (nth 1 today))
- (this-hour (nth 2 today))
- (this-day (nth 3 today))
- (this-month (nth 4 today))
- (this-year (nth 5 today))
+ (this-minute (decoded-time-minute today))
+ (this-hour (decoded-time-hour today))
+ (this-day (decoded-time-day today))
+ (this-month (decoded-time-month today))
+ (this-year (decoded-time-year today))
(minute-list (sort (nndiary-flatten (nth 0 sched) 0 59) '<))
(hour-list (sort (nndiary-flatten (nth 1 sched) 0 23) '<))
(dom-list (nth 2 sched))
;; have to know which day is the 1st one for this month.
;; Maybe there's simpler, but decode-time(encode-time) will
;; give us the answer.
- (let ((first (nth 6 (decode-time
- (encode-time 0 0 0 1 month year
- time-zone))))
+ (let ((first (decoded-time-weekday
+ (decode-time
+ (encode-time 0 0 0 1 month year
+ time-zone))))
(max (cond ((= month 2)
(if (date-leap-year-p year) 29 28))
((<= month 7)
(format-time-string
(format "%%d-%s-%%Y"
(upcase
- (car (rassoc (nth 4 (decode-time cutoff))
+ (car (rassoc (decoded-time-month (decode-time cutoff))
parse-time-months))))
cutoff))))
(and (car result)