changeset 82959:793ad36b6e6e

(time-to-number-of-days): New function. Imported from from Gnus.
author Reiner Steib <Reiner.Steib@gmx.de>
date Mon, 16 Aug 2004 09:59:46 +0000
parents a73a1f552d68
children 4ab2523af708
files lisp/ChangeLog lisp/calendar/time-date.el
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Aug 05 19:18:14 2004 +0000
+++ b/lisp/ChangeLog	Mon Aug 16 09:59:46 2004 +0000
@@ -1,3 +1,8 @@
+2004-08-16  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* calendar/time-date.el (time-to-number-of-days): New function.
+	Imported from from Gnus.
+
 2004-07-22  Kim F. Storm  <storm@cua.dk>
 
 	* progmodes/make-mode.el: Fix comments.
--- a/lisp/calendar/time-date.el	Thu Aug 05 19:18:14 2004 +0000
+++ b/lisp/calendar/time-date.el	Mon Aug 16 09:59:46 2004 +0000
@@ -1,5 +1,5 @@
 ;;; time-date.el --- date and time handling functions
-;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;	Masanobu Umeda <umerin@mse.kyutech.ac.jp>
@@ -38,7 +38,7 @@
 	     (parse-time-string
 	      ;; `parse-time-string' isn't sufficiently general or
 	      ;; robust.  It fails to grok some of the formats that
-	      ;; timzeone does (e.g. dodgy post-2000 stuff from some
+	      ;; timezone does (e.g. dodgy post-2000 stuff from some
 	      ;; Elms) and either fails or returns bogus values.  Lars
 	      ;; reverted this change, but that loses non-trivially
 	      ;; often for me.  -- fx
@@ -176,6 +176,11 @@
        (- (/ (1- year) 100))		;	- century years
        (/ (1- year) 400))))		;	+ Gregorian leap years
 
+(defun time-to-number-of-days (time)
+  "Return the number of days represented by TIME.
+The number of days will be returned as a floating point number."
+  (/ (+ (* 1.0 65536 (car time)) (cadr time)) (* 60 60 24)))
+
 ;;;###autoload
 (defun safe-date-to-time (date)
   "Parse a string that represents a date-time and return a time value.