Show
Ignore:
Timestamp:
08/24/08 13:30:08 (5 months ago)
Author:
g000001
Message:

lang/commonlisp/xyzzy-compat: parse-date-stringで、scanを2回実行していたので、一回に短縮した。

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/commonlisp/xyzzy-compat/timestamp.lisp

    r17927 r18164  
    241241 
    242242(defun parse-date-string (string) 
    243   (when (and (stringp string) 
    244              (ppcre:scan *date-format-regexp* string)) 
    245     (handler-case  
    246         (apply #'encode-universal-time 
    247                (nreverse 
    248                 (map 'list #'parse-integer 
    249                      (nth-value 1 (ppcre:scan-to-strings *date-format-regexp* string))))) 
    250       (error () nil)))) 
     243  (multiple-value-bind (win parts)  
     244      (ppcre:scan-to-strings *date-format-regexp*  
     245                             (and (stringp string) string)) 
     246    (when win 
     247      (handler-case  
     248          (apply #'encode-universal-time 
     249                 (nreverse (map 'list #'parse-integer parts))) 
     250        (error () nil))))) 
    251251 
    252252; usage 
    253253;(format-date-string (nth 12 *date-formats*) 
    254254;                    (get-universal-time)) 
    255 ;"平成20年8月19日 火曜日" 
     255;=> "平成20年8月19日 火曜日" 
     256 
     257;(parse-date-string "1999/01/01 17:00:0") 
     258;=> 3124166400