summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-12-03 08:57:37 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-12-03 08:57:37 +0100
commit2faaacfeeb5d8544f5cf68279fe8c0492b867774 (patch)
treec461218e46e95d4fcf6176cdda3d48fb2d2541c8
parent14620fdf0c830f2dafe28438569ae364a1b0b621 (diff)
downloadorg-mode-2faaacfeeb5d8544f5cf68279fe8c0492b867774.tar.gz
Revert the whole time zone mess
* lisp/org.el (org-time-string-to-time): (org-time-string-to-seconds): Remove optional ZONE argument. (org-2ft): (org-check-before-date): (org-check-after-date): (org-check-dates-range): (org-parse-time-string): * lisp/org-clock.el (org-clock-get-sum-start): (org-clock-out): (org-clock-timestamps-change): (org-clock-sum): (org-clock-update-time-maybe): * lisp/org-colview.el (org-columns--age-to-minutes): Apply change. * testing/lisp/test-org-clock.el (org-test-clock-create-clock): (test-org-clock/clocktable/scope): * testing/lisp/test-org-colview.el (test-org-colview/columns-summary): Apply change. Simplify tests to avoid daylight saving time issue.
-rw-r--r--etc/ORG-NEWS3
-rw-r--r--lisp/ob-gnuplot.el2
-rw-r--r--lisp/org-clock.el23
-rw-r--r--lisp/org-colview.el2
-rw-r--r--lisp/org-list.el2
-rw-r--r--lisp/org.el46
-rw-r--r--testing/lisp/test-org-clock.el16
-rw-r--r--testing/lisp/test-org-colview.el18
8 files changed, 49 insertions, 63 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 19648cf..7ed839a 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -492,9 +492,6 @@ It used to be ~@samp~ but ~@asis~ is neutral and, therefore, more
suitable as a default value.
*** Texinfo default process includes ~--no-split~ option
*** New entities : ~\dollar~ and ~\USD~
-*** ~org-parse-time-string~ accepts a new optional argument
-=ZONE= specifies the current time zone.
-*** ~org-time-string-to-seconds~ now accepts an optional =ZONE= argument
*** Support for date style URLs in =org-protocol://open-source=
URLs like =https://cool-blog.com/2017/05/20/cool-post/= are
covered by rewrite rules.
diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index 7633862..b0743f6 100644
--- a/lisp/ob-gnuplot.el
+++ b/lisp/ob-gnuplot.el
@@ -40,7 +40,7 @@
;;; Code:
(require 'ob)
-(declare-function org-time-string-to-time "org" (s &optional zone))
+(declare-function org-time-string-to-time "org" (s))
(declare-function org-combine-plists "org" (&rest plists))
(declare-function orgtbl-to-generic "org-table" (table params))
(declare-function gnuplot-mode "ext:gnuplot-mode" ())
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 83d0e12..0e7eb21 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1467,7 +1467,7 @@ The time is always returned as UTC."
(and (or (not cmt) (equal cmt "auto"))
lr))
(setq org--msg-extra "showing task time since last repeat.")
- (and lr (org-time-string-to-time lr t)))
+ (and lr (org-time-string-to-time lr)))
(t nil))))
(defun org-clock-find-position (find-unclosed)
@@ -1604,9 +1604,9 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(insert "--")
(setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
(setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te nil t)))
+ (apply #'encode-time (org-parse-time-string te)))
(float-time
- (apply #'encode-time (org-parse-time-string ts nil t))))
+ (apply #'encode-time (org-parse-time-string ts))))
h (floor (/ s 3600))
s (- s (* 3600 h))
m (floor (/ s 60))
@@ -1711,8 +1711,8 @@ Optional argument N tells to change by that many units."
(begts (if updatets1 begts1 begts2)))
(setq tdiff
(time-subtract
- (org-time-string-to-time org-last-changed-timestamp t)
- (org-time-string-to-time ts t)))
+ (org-time-string-to-time org-last-changed-timestamp)
+ (org-time-string-to-time ts)))
(save-excursion
(goto-char begts)
(org-timestamp-change
@@ -1820,10 +1820,10 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(lmax 30)
(ltimes (make-vector lmax 0))
(level 0)
- (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart t))
+ (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart))
((consp tstart) (float-time tstart))
(t tstart)))
- (tend (cond ((stringp tend) (org-time-string-to-seconds tend t))
+ (tend (cond ((stringp tend) (org-time-string-to-seconds tend))
((consp tend) (float-time tend))
(t tend)))
(t1 0)
@@ -1840,11 +1840,10 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(let* ((ts (float-time
(apply #'encode-time
(save-match-data
- (org-parse-time-string
- (match-string 2) nil t)))))
+ (org-parse-time-string (match-string 2))))))
(te (float-time
(apply #'encode-time
- (org-parse-time-string (match-string 3) nil t))))
+ (org-parse-time-string (match-string 3)))))
(dt (- (if tend (min te tend) te)
(if tstart (max ts tstart) ts))))
(when (> dt 0) (cl-incf t1 (floor (/ dt 60))))))
@@ -2902,9 +2901,9 @@ Otherwise, return nil."
(setq ts (match-string 1)
te (match-string 3))
(setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te nil t)))
+ (apply #'encode-time (org-parse-time-string te)))
(float-time
- (apply #'encode-time (org-parse-time-string ts nil t))))
+ (apply #'encode-time (org-parse-time-string ts))))
neg (< s 0)
s (abs s)
h (floor (/ s 3600))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index eac29c5..649ca52 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1070,7 +1070,7 @@ as a canonical duration, i.e., using units defined in
(cond
((string-match-p org-ts-regexp s)
(/ (- org-columns--time
- (float-time (apply #'encode-time (org-parse-time-string s nil t))))
+ (float-time (apply #'encode-time (org-parse-time-string s))))
60))
((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units
(t (user-error "Invalid age: %S" s))))
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 8ea569f..5b292d0 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -149,7 +149,7 @@
(declare-function org-remove-indentation "org" (code &optional n))
(declare-function org-show-subtree "org" ())
(declare-function org-sort-remove-invisible "org" (S))
-(declare-function org-time-string-to-seconds "org" (s &optional zone))
+(declare-function org-time-string-to-seconds "org" (s))
(declare-function org-timer-hms-to-secs "org-timer" (hms))
(declare-function org-timer-item "org-timer" (&optional arg))
(declare-function org-trim "org" (s &optional keep-lead))
diff --git a/lisp/org.el b/lisp/org.el
index fbdcca0..b283899 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14632,7 +14632,7 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0."
((numberp s) s)
((stringp s)
(condition-case nil
- (float-time (apply #'encode-time (org-parse-time-string s nil t)))
+ (float-time (apply #'encode-time (org-parse-time-string s)))
(error 0.)))
(t 0.)))
@@ -17391,8 +17391,8 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(time-less-p
- (org-time-string-to-time match t)
- (org-time-string-to-time d t)))))))
+ (org-time-string-to-time match)
+ (org-time-string-to-time d)))))))
(message "%d entries before %s"
(org-occur regexp nil callback)
d)))
@@ -17413,8 +17413,8 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(not (time-less-p
- (org-time-string-to-time match t)
- (org-time-string-to-time d t))))))))
+ (org-time-string-to-time match)
+ (org-time-string-to-time d))))))))
(message "%d entries after %s"
(org-occur regexp nil callback)
d)))
@@ -17437,11 +17437,11 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(not (time-less-p
- (org-time-string-to-time match t)
- (org-time-string-to-time start-date t)))
+ (org-time-string-to-time match)
+ (org-time-string-to-time start-date)))
(time-less-p
- (org-time-string-to-time match t)
- (org-time-string-to-time end-date t))))))))
+ (org-time-string-to-time match)
+ (org-time-string-to-time end-date))))))))
(message "%d entries between %s and %s"
(org-occur regexp nil callback) start-date end-date)))
@@ -17526,19 +17526,13 @@ days in order to avoid rounding problems."
(push m l))
(apply 'format fmt (nreverse l))))
-(defun org-time-string-to-time (s &optional zone)
- "Convert timestamp string S into internal time.
-The optional ZONE is omitted or nil for Emacs local time, t for
-Universal Time, ‘wall’ for system wall clock time, or a string as
-in the TZ environment variable."
- (apply #'encode-time (org-parse-time-string s nil zone)))
+(defun org-time-string-to-time (s)
+ "Convert timestamp string S into internal time."
+ (apply #'encode-time (org-parse-time-string s)))
-(defun org-time-string-to-seconds (s &optional zone)
- "Convert a timestamp string S into a number of seconds.
-The optional ZONE is omitted or nil for Emacs local time, t for
-Universal Time, ‘wall’ for system wall clock time, or a string as
-in the TZ environment variable."
- (float-time (org-time-string-to-time s zone)))
+(defun org-time-string-to-seconds (s)
+ "Convert a timestamp string S into a number of seconds."
+ (float-time (org-time-string-to-time s)))
(org-define-error 'org-diary-sexp-no-match "Unable to match diary sexp")
@@ -17755,17 +17749,13 @@ day number."
(list (nth 4 d) (nth 3 d) (nth 5 d))))
((listp d) (list (nth 4 d) (nth 3 d) (nth 5 d)))))
-(defun org-parse-time-string (s &optional nodefault zone)
+(defun org-parse-time-string (s &optional nodefault)
"Parse the standard Org time string.
This should be a lot faster than the normal `parse-time-string'.
If time is not given, defaults to 0:00. However, with optional
-NODEFAULT, hour and minute fields will be nil if not given.
-
-The optional ZONE is omitted or nil for Emacs local time, t for
-Universal Time, ‘wall’ for system wall clock time, or a string as
-in the TZ environment variable."
+NODEFAULT, hour and minute fields will be nil if not given."
(cond ((string-match org-ts-regexp0 s)
(list 0
(when (or (match-beginning 8) (not nodefault))
@@ -17775,7 +17765,7 @@ in the TZ environment variable."
(string-to-number (match-string 4 s))
(string-to-number (match-string 3 s))
(string-to-number (match-string 2 s))
- nil nil zone))
+ nil nil nil))
((string-match "^<[^>]+>$" s)
;; FIXME: `decode-time' needs to be called with ZONE as its
;; second argument. However, this requires at least Emacs
diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 98dab5b..b7b09ed 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -49,8 +49,8 @@ Return the clock line as a string."
(let* ((beg (org-test-clock-create-timestamp input1 t t))
(end (and input2 (org-test-clock-create-timestamp input2 t t)))
(sec-diff (and input2
- (floor (- (org-time-string-to-seconds end t)
- (org-time-string-to-seconds beg t))))))
+ (floor (- (org-time-string-to-seconds end)
+ (org-time-string-to-seconds beg))))))
(concat org-clock-string " " beg
(when end
(concat "--" end " => "
@@ -344,15 +344,15 @@ the buffer."
;; line, and ignore "file" column.
(should
(equal
- "| Headline | Time | |
-|--------------+------------+-----|
-| *Total time* | *16904:01* | foo |
-|--------------+------------+-----|
-| Test | 16904:01 | foo |
+ "| Headline | Time | |
+|--------------+--------+-----|
+| *Total time* | *8:40* | foo |
+|--------------+--------+-----|
+| Test | 8:40 | foo |
#+TBLFM: $3=string(\"foo\")"
(org-test-with-temp-text-in-file
"* Test
-CLOCK: [2012-03-29 Thu 16:40]--[2014-03-04 Thu 00:41] => 16904:01"
+CLOCK: [2012-03-29 Thu 8:00]--[2012-03-29 Thu 16:40] => 8:40"
(test-org-clock-clocktable-contents ":scope file-with-archives"
"#+TBLFM: $3=string(\"foo\")"))))
;; Test "function" scope.
diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 85c1bcf..5e1fe56 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -513,7 +513,7 @@
(cl-letf (((symbol-function 'current-time)
(lambda ()
(apply #'encode-time
- (org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+ (org-parse-time-string "<2014-03-04 Tue>")))))
(org-test-with-temp-text
"* H
** S1
@@ -528,39 +528,39 @@
(get-char-property (point) 'org-columns-value-modified)))))
(should
(equal
- "705d"
+ "2d"
(cl-letf (((symbol-function 'current-time)
(lambda ()
(apply #'encode-time
- (org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+ (org-parse-time-string "<2014-03-04 Tue>")))))
(org-test-with-temp-text
"* H
** S1
:PROPERTIES:
-:A: <2012-03-29 Thu>
+:A: <2014-03-03 Mon>
:END:
** S1
:PROPERTIES:
-:A: <2014-03-04 Tue>
+:A: <2014-03-02 Sun>
:END:"
(let ((org-columns-default-format "%A{@max}")) (org-columns))
(get-char-property (point) 'org-columns-value-modified)))))
(should
(equal
- "352d 12h"
+ "1d 12h"
(cl-letf (((symbol-function 'current-time)
(lambda ()
(apply #'encode-time
- (org-parse-time-string "<2014-03-04 Tue>" nil t)))))
+ (org-parse-time-string "<2014-03-04 Tue>")))))
(org-test-with-temp-text
"* H
** S1
:PROPERTIES:
-:A: <2012-03-29 Thu>
+:A: <2014-03-03 Mon>
:END:
** S1
:PROPERTIES:
-:A: <2014-03-04 Tue>
+:A: <2014-03-02 Sun>
:END:"
(let ((org-columns-default-format "%A{@mean}")) (org-columns))
(get-char-property (point) 'org-columns-value-modified)))))