changeset 16099:e3b0c3bf4451

(calendar-current-date): Simplify by using decode-time instead of parsing current-time-string.
author Richard M. Stallman <rms@gnu.org>
date Tue, 03 Sep 1996 23:27:01 +0000
parents b463288de0a8
children ccd19852de65
files lisp/calendar/calendar.el
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/calendar.el	Tue Sep 03 23:25:46 1996 +0000
+++ b/lisp/calendar/calendar.el	Tue Sep 03 23:27:01 1996 +0000
@@ -1938,12 +1938,8 @@
 
 (defun calendar-current-date ()
   "Returns the current date in a list (month day year)."
-  (let ((s (current-time-string)))
-    (list (length (member (substring s 4 7)
-                          '("Dec" "Nov" "Oct" "Sep" "Aug" "Jul"
-                            "Jun" "May" "Apr" "Mar" "Feb" "Jan")))
-          (string-to-number (substring s 8 10))
-          (string-to-number (substring s 20 24)))))
+  (let ((now (decode-time)))
+    (list (nth 4 now) (nth 3 now) (nth 5 now))))
 
 (defun calendar-cursor-to-date (&optional error)
   "Returns a list (month day year) of current cursor position.