Function: timezone-parse-time

timezone-parse-time is a byte-compiled function defined in timezone.el.gz.

Signature

(timezone-parse-time TIME)

Documentation

Parse TIME (HH:MM:SS) and return a vector [hour minute second].

Recognize HH:MM:SS, HH:MM, HHMMSS, HHMM.

Source Code

;; Defined in /usr/src/emacs/lisp/timezone.el.gz
(defun timezone-parse-time (time)
  "Parse TIME (HH:MM:SS) and return a vector [hour minute second].
Recognize HH:MM:SS, HH:MM, HHMMSS, HHMM."
  (let ((time (or time ""))
	hour minute second)
    (cond ((string-match "\\`\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)\\'" time)
	   ;; HH:MM:SS
	   (setq hour 1 minute 2 second 3))
	  ((string-match "\\`\\([0-9]+\\):\\([0-9]+\\)\\'" time)
	   ;; HH:MM
	   (setq hour 1 minute 2 second nil))
	  ((string-match "\\`\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\'" time)
	   ;; HHMMSS
	   (setq hour 1 minute 2 second 3))
	  ((string-match "\\`\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\'" time)
	   ;; HHMM
	   (setq hour 1 minute 2 second nil))
	  )
    ;; Return [hour minute second]
    (vector
     (if hour (match-string hour time) "0")
     (if minute (match-string minute time) "0")
     (if second (match-string second time) "0"))))