;;; time-date.el --- Date and time handling functions
-;; Copyright (C) 1998,99 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Masanobu Umeda <umerin@mse.kyutech.ac.jp>
+;; Keywords: mail news util
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;;; Code:
+(eval-when-compile (require 'cl))
+
(require 'parse-time)
+;;;###autoload
(defun date-to-time (date)
"Convert DATE into time."
(condition-case ()
"Convert TIME to a floating point number."
(+ (* (car time) 65536.0)
(cadr time)
- (/ (or (caddr time) 0) 1000000.0)))
+ (/ (or (nth 2 time) 0) 1000000.0)))
(defun seconds-to-time (seconds)
"Convert SECONDS (a floating point number) to an Emacs time structure."
(defun date-to-day (date)
"Return the number of days between year 1 and DATE."
(time-to-days (date-to-time date)))
-
+
(defun days-between (date1 date2)
"Return the number of days between DATE1 and DATE2."
(- (date-to-day date1) (date-to-day date2)))
(- (/ (1- year) 100)) ; - century years
(/ (1- year) 400)))) ; + Gregorian leap years
+;;;###autoload
(defun safe-date-to-time (date)
"Parse DATE and return a time structure.
If DATE is malformed, a zero time will be returned."