Mercurial > hg > xemacs-beta
diff lisp/subr.el @ 5220:2157ecaedc1d
Add `float-time', implemented in Lisp.
2010-05-30 Aidan Kehoe <kehoea@parhasard.net>
* subr.el (float-time): Add this function, available in editfns.c
in GNU.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 30 May 2010 15:14:29 +0100 |
parents | 2e528066e2fc |
children | aa20a889ff14 308d34e9f07d |
line wrap: on
line diff
--- a/lisp/subr.el Sun May 16 12:49:49 2010 +0100 +++ b/lisp/subr.el Sun May 30 15:14:29 2010 +0100 @@ -1794,4 +1794,23 @@ "Return t if (cdr A) is numerically less than (cdr B)." (< (cdr a) (cdr b))) +;; XEmacs; this is in editfns.c in GNU. +(defun float-time (&optional specified-time) + "Convert time value SPECIFIED-TIME to a floating point number. + +See `current-time'. Since the result is a floating-point number, this may +not have the same accuracy as does the result of `current-time'. + +If not supplied, SPECIFIED-TIME defaults to the result of `current-time'." + (or specified-time (setq specified-time (current-time))) + (+ (* (pop specified-time) (+ #x10000 0.0)) + (if (consp specified-time) + (pop specified-time) + (prog1 + specified-time + (setq specified-time nil))) + (or (and specified-time + (/ (car specified-time) 1000000.0)) + 0.0))) + ;;; subr.el ends here