1 |
;;; time-date.el --- date and time handling functions |
;;; time-date.el --- date and time handling functions |
2 |
;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. |
;; Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
5 |
;; Masanobu Umeda <umerin@mse.kyutech.ac.jp> |
;; Masanobu Umeda <umerin@mse.kyutech.ac.jp> |
38 |
(parse-time-string |
(parse-time-string |
39 |
;; `parse-time-string' isn't sufficiently general or |
;; `parse-time-string' isn't sufficiently general or |
40 |
;; robust. It fails to grok some of the formats that |
;; robust. It fails to grok some of the formats that |
41 |
;; timzeone does (e.g. dodgy post-2000 stuff from some |
;; timezone does (e.g. dodgy post-2000 stuff from some |
42 |
;; Elms) and either fails or returns bogus values. Lars |
;; Elms) and either fails or returns bogus values. Lars |
43 |
;; reverted this change, but that loses non-trivially |
;; reverted this change, but that loses non-trivially |
44 |
;; often for me. -- fx |
;; often for me. -- fx |
177 |
(- (/ (1- year) 100)) ; - century years |
(- (/ (1- year) 100)) ; - century years |
178 |
(/ (1- year) 400)))) ; + Gregorian leap years |
(/ (1- year) 400)))) ; + Gregorian leap years |
179 |
|
|
180 |
|
(defun time-to-number-of-days (time) |
181 |
|
"Return the number of days represented by TIME. |
182 |
|
The number of days will be returned as a floating point number." |
183 |
|
(/ (+ (* 1.0 65536 (car time)) (cadr time)) (* 60 60 24))) |
184 |
|
|
185 |
;;;###autoload |
;;;###autoload |
186 |
(defun safe-date-to-time (date) |
(defun safe-date-to-time (date) |
187 |
"Parse a string that represents a date-time and return a time value. |
"Parse a string that represents a date-time and return a time value. |