comparison 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
comparison
equal deleted inserted replaced
5212:4f98237e23fc 5220:2157ecaedc1d
1792 ;; Used in packages. 1792 ;; Used in packages.
1793 (defun cdr-less-than-cdr (a b) 1793 (defun cdr-less-than-cdr (a b)
1794 "Return t if (cdr A) is numerically less than (cdr B)." 1794 "Return t if (cdr A) is numerically less than (cdr B)."
1795 (< (cdr a) (cdr b))) 1795 (< (cdr a) (cdr b)))
1796 1796
1797 ;; XEmacs; this is in editfns.c in GNU.
1798 (defun float-time (&optional specified-time)
1799 "Convert time value SPECIFIED-TIME to a floating point number.
1800
1801 See `current-time'. Since the result is a floating-point number, this may
1802 not have the same accuracy as does the result of `current-time'.
1803
1804 If not supplied, SPECIFIED-TIME defaults to the result of `current-time'."
1805 (or specified-time (setq specified-time (current-time)))
1806 (+ (* (pop specified-time) (+ #x10000 0.0))
1807 (if (consp specified-time)
1808 (pop specified-time)
1809 (prog1
1810 specified-time
1811 (setq specified-time nil)))
1812 (or (and specified-time
1813 (/ (car specified-time) 1000000.0))
1814 0.0)))
1815
1797 ;;; subr.el ends here 1816 ;;; subr.el ends here