[mew-dist 29257] mew-time-rfc-to-sortkey() での year 補正

Hideyuki SHIRAI (白井秀行) <[email protected]>
Newsgroups gmane.mail.mew.general.japanese
Organization Resident at Meadowy farm.
Message-ID <[email protected]>

Date  sort 

Date: Sat, 1 Jan 100 12:07:56 +0900

 2000

() mew-time-rfc-to-sortkey() 


(defun mew-time-rfc-to-sortkey (s &optional tzadj)
  (if (string-match mew-time-rfc-regex s)
      (let ((year (mew-time-rfc-year))
	    (mon  (mew-time-mon-str-to-int (mew-time-rfc-mon)))
	    (day  (mew-time-rfc-day))
	    (hour (mew-time-rfc-hour))
	    (min  (mew-time-rfc-min))
	    (sec  (mew-time-rfc-sec))
	    (tmzn (mew-time-rfc-tmzn)))
	(cond
	 ((< year 50)
	  (setq year (+ year 2000)))
	 ((< year 150) ;; 
	  (setq year (+ year 1900))))
	(if (or (< year 1970) (>= year 2038))
	    ;; invalid data
	    (mew-time-ctz-to-sortkey-invalid sec min hour day mon year)
	  (setq sec (- sec tmzn))
	  (if tzadj (setq sec (+ sec (car (current-time-zone)))))
	  (mew-time-ctz-to-sortkey (encode-time sec min hour day mon year))))))


:
(mew-time-rfc-to-sortkey "Sat, 1 Jan 100 12:07:56 +0900")
"01000101120756"

:
(mew-time-rfc-to-sortkey "Sat, 1 Jan 100 12:07:56 +0900")
"20000101030756"


-- 
 (mailto:[email protected])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.