Mercurial > emacs
comparison lisp/calendar/time-date.el @ 56927:55fd4f77387a after-merge-gnus-5_10
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Merge from emacs--gnus--5.10, gnus--rel--5.10
Patches applied:
* miles@gnu.org--gnu-2004/emacs--gnus--5.10--base-0
tag of miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-464
* miles@gnu.org--gnu-2004/emacs--gnus--5.10--patch-1
Import from CVS branch gnus-5_10-branch
* miles@gnu.org--gnu-2004/emacs--gnus--5.10--patch-2
Merge from lorentey@elte.hu--2004/emacs--multi-tty--0, emacs--cvs-trunk--0
* miles@gnu.org--gnu-2004/emacs--gnus--5.10--patch-3
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--gnus--5.10--patch-4
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-18
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-19
Remove autoconf-generated files from archive
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-20
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 04 Sep 2004 13:13:48 +0000 |
parents | 2383026ff0d9 |
children | 608b5e008a8b cce1c0ee76ee |
comparison
equal
deleted
inserted
replaced
56926:f8e248e9a717 | 56927:55fd4f77387a |
---|---|
1 ;;; time-date.el --- date and time handling functions | 1 ;;; time-date.el --- date and time handling functions |
2 ;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. | 2 ;; Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc. |
3 | 3 |
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | 4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
5 ;; Masanobu Umeda <umerin@mse.kyutech.ac.jp> | 5 ;; Masanobu Umeda <umerin@mse.kyutech.ac.jp> |
6 ;; Keywords: mail news util | 6 ;; Keywords: mail news util |
7 | 7 |
36 (condition-case () | 36 (condition-case () |
37 (apply 'encode-time | 37 (apply 'encode-time |
38 (parse-time-string | 38 (parse-time-string |
39 ;; `parse-time-string' isn't sufficiently general or | 39 ;; `parse-time-string' isn't sufficiently general or |
40 ;; robust. It fails to grok some of the formats that | 40 ;; robust. It fails to grok some of the formats that |
41 ;; timzeone does (e.g. dodgy post-2000 stuff from some | 41 ;; timezone does (e.g. dodgy post-2000 stuff from some |
42 ;; Elms) and either fails or returns bogus values. Lars | 42 ;; Elms) and either fails or returns bogus values. Lars |
43 ;; reverted this change, but that loses non-trivially | 43 ;; reverted this change, but that loses non-trivially |
44 ;; often for me. -- fx | 44 ;; often for me. -- fx |
45 (timezone-make-date-arpa-standard date))) | 45 (timezone-make-date-arpa-standard date))) |
46 (error (error "Invalid date: %s" date)))) | 46 (error (error "Invalid date: %s" date)))) |
175 (* 365 (1- year)) ; + Days in prior years | 175 (* 365 (1- year)) ; + Days in prior years |
176 (/ (1- year) 4) ; + Julian leap years | 176 (/ (1- year) 4) ; + Julian leap years |
177 (- (/ (1- year) 100)) ; - century years | 177 (- (/ (1- year) 100)) ; - century years |
178 (/ (1- year) 400)))) ; + Gregorian leap years | 178 (/ (1- year) 400)))) ; + Gregorian leap years |
179 | 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 | |
180 ;;;###autoload | 185 ;;;###autoload |
181 (defun safe-date-to-time (date) | 186 (defun safe-date-to-time (date) |
182 "Parse a string that represents a date-time and return a time value. | 187 "Parse a string that represents a date-time and return a time value. |
183 If DATE is malformed, return a time value of zeros." | 188 If DATE is malformed, return a time value of zeros." |
184 (condition-case () | 189 (condition-case () |