diff options
author | Bastien Guerry <bzg@altern.org> | 2011-07-24 18:19:17 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-07-24 18:19:17 +0200 |
commit | 9c5a8ab2958b63ca979883cb7389c2677fa203cb (patch) | |
tree | 7ecf5c8bbe4e14edde6bc4ab514a2c259ebddb70 | |
parent | 88eada52a63539b8866b9be861ea72ffbcafb37e (diff) | |
download | org-mode-9c5a8ab2958b63ca979883cb7389c2677fa203cb.tar.gz |
org-table: match either HH:MM:SS or HH:MM (instead of MM:SS).
* org-table.el (org-table-time-string-to-seconds): match
either HH:MM:SS or HH:MM (instead of MM:SS).
Thanks to Gustav Wikström for suggesting this change.
-rw-r--r-- | lisp/org-table.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/org-table.el b/lisp/org-table.el index c7d0b72..af1d884 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -3206,7 +3206,8 @@ For example: 28 -> AB." s)) (defun org-table-time-string-to-seconds (s) - "Convert a time string into numerical duration in seconds." + "Convert a time string into numerical duration in seconds. +S is a string matching either HH:MM:SS or HH:MM." (cond ((and (stringp s) (string-match "\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\)" s)) @@ -3217,9 +3218,9 @@ For example: 28 -> AB." ((and (stringp s) (not (string-match org-ts-regexp-both s)) (string-match "\\([0-9]+\\):\\([0-9]+\\)" s)) - (let ((min (string-to-number (match-string 1 s))) - (sec (string-to-number (match-string 2 s)))) - (+ (* min 60) sec))))) + (let ((hour (string-to-number (match-string 1 s))) + (min (string-to-number (match-string 2 s)))) + (+ (* hour 3600) (* min 60)))))) (defun org-table-time-seconds-to-string (secs) "Convert a number of seconds to a time string." |