From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dale Sedivec Subject: Bug: clocktable interprets tstart/tend incorrectly, maybe? [9.0.9 (9.0.9-636-gd39ccc-elpaplus @ /tmp/emacs/.emacs.d/elpa/org-plus-contrib-20170709/)] Date: Sun, 9 Jul 2017 15:46:27 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f403045eb616d519dc0553e891d4" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUJ7n-0007S8-Jg for emacs-orgmode@gnu.org; Sun, 09 Jul 2017 16:48:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUJ7k-0004K5-E6 for emacs-orgmode@gnu.org; Sun, 09 Jul 2017 16:48:15 -0400 Received: from mail-yb0-f174.google.com ([209.85.213.174]:33106) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUJ7k-0004J5-4a for emacs-orgmode@gnu.org; Sun, 09 Jul 2017 16:48:12 -0400 Received: by mail-yb0-f174.google.com with SMTP id 84so22840448ybe.0 for ; Sun, 09 Jul 2017 13:48:09 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --f403045eb616d519dc0553e891d4 Content-Type: text/plain; charset="UTF-8" Hi! I think clocktables may be parsing time zones incorrectly in :tstart and :tend, leading to incorrect output. Steps to reproduce: 1. Start a fresh Emacs within that same along the lines of: ~~~~~~ mkdir /tmp/emacs TZ=America/Chicago HOME=/tmp/emacs /path/to/emacs ~~~~~~ I *think* setting TZ to a non-UTC time zone is important to reproduce this. 2. Install latest org-mode from Git. I did this via package-install-file on a package I built from a Git checkout of the org-mode repository. 3. Open an org-mode buffer, e.g. C-x C-f ~/test.org RET. 4. Insert: ~~~~~~ #+BEGIN: clocktable :maxlevel 2 :scope file :step day :tstart "<2017-07-02 Sun>" :tend "<2017-07-09 Sun>" #+END: ~~~~~~ 5. Save the buffer. 6. Move point to the start of that dblock and C-c C-c to update it. Expected results: First step is "Daily report: [2017-07-02 Sun]" which matches the :tstart. Actual results: First step is "Daily report: [2017-07-01 Sat]", the day before the :tstart date. The last step is also 2017-07-07, not 2017-07-08 as I was expecting. I notice that as of 112c5ba479d, org-clocktable-steps parses :tstart and :tend with the ZONE argument to org-parse-time-string as T. I think this is causing org-parse-time-string to parse these user-entered dates as UTC rather than the user's local time as I would have expected. Changing org-clocktable-steps from doing (org-parse-time-string ts nil t) to (org-parse-time-string ts nil nil), and then the same for te as well, seems to fix this problem. But time/date math is hard, and this is just a guess as to where the problem might lie. Emacs : GNU Emacs 25.2.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G1421)) of 2017-04-24 Package: Org mode version 9.0.9 (9.0.9-636-gd39ccc-elpaplus @ /tmp/emacs/.emacs.d/elpa/org-plus-contrib-20170709/) current state: ============== (setq org-src-lang-modes '(("sclang" . sclang) ("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql) ("calc" . fundamental) ("C" . c) ("cpp" . c++) ("C++" . c++) ("screen" . shell-script) ("shell" . sh) ("bash" . sh)) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-occur-hook '(org-first-headline-recenter) org-metaup-hook '(org-babel-load-in-session-maybe) org-html-format-drawer-function '(closure (htmlize-buffer-places org-html-format-table-no-css htmlize-css-name-prefix htmlize-output-type htmlize-output-type htmlize-css-name-prefix t) (_name contents) contents) org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function org-confirm-shell-link-function 'yes-or-no-p org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-latex-format-headline-function 'org-latex-format-headline-default-function org-after-todo-state-change-hook '(org-clock-out-if-current) org-latex-format-drawer-function '(closure (t) (_ contents) contents) org-odt-format-headline-function 'org-odt-format-headline-default-function org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-babel-pre-tangle-hook '(save-buffer) org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] (closure (org-inlinetask-min-level buffer-face-mode-face org-mode-map org-tbl-menu org-org-menu org-struct-menu org-entities org-last-state org-id-track-globally org-clock-start-time texmathp-why remember-data-file org-agenda-tags-todo-honor-ignore-options iswitchb-temp-buflist align-mode-rules-list org-emphasis-alist org-emphasis-regexp-components org-export-registered-backends org-modules org-babel-load-languages ffap-url-regexp t) nil (add-hook (quote change-major-mode-hook) (quote org-show-block-all) (quote append) (quote local)) ) (closure (org-bracket-link-regexp org-src-window-setup *this* org-babel-confirm-evaluate-answer-no org-src-preserve-indentation org-src-lang-modes org-edit-src-content-indentation org-babel-library-of-babel t) nil (add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all) (quote append) (quote local)) ) org-babel-result-hide-spec org-babel-hide-all-hashes org-eldoc-load) org-bibtex-headline-format-function '(closure (org-agenda-search-view-always-boolean org-agenda-overriding-header t) (entry) (cdr (assq :title entry))) org-archive-hook '(org-attach-archive-delete-maybe) org-ascii-format-drawer-function '(closure (t) (_name contents _width) contents) org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-confirm-elisp-link-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-odt-format-drawer-function '(closure (hfy-user-sheet-assoc hfy-html-quote-regex hfy-html-quote-map hfy-face-to-css hfy-begin-span-handler hfy-end-span-handler archive-zip-extract nxml-auto-insert-xml-declaration-flag t) (_name contents) contents) org-html-format-headline-function 'org-html-format-headline-default-function org-link-parameters '(("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link) ("info" :follow org-info-open :export org-info-export :store org-info-store-link) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("id" :follow org-id-open) ("file+sys") ("file+emacs") ("doi" :follow org--open-doi-link) ("elisp" :follow org--open-elisp-link) ("file" :complete org-file-complete-link) ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path)))) ("help" :follow org--open-help-link) ("http" :follow (lambda (path) (browse-url (concat "http:" path)))) ("https" :follow (lambda (path) (browse-url (concat "https:" path)))) ("mailto" :follow (lambda (path) (browse-url (concat "mailto:" path)))) ("news" :follow (lambda (path) (browse-url (concat "news:" path)))) ("shell" :follow org--open-shell-link)) org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function org-clock-out-hook '(org-clock-remove-empty-clock-drawer) ) Regards, Dale --f403045eb616d519dc0553e891d4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!=C2=A0 I think clocktables may be parsing time zon= es incorrectly in :tstart and :tend, leading to incorrect output.=C2=A0 Ste= ps to reproduce:

1. Start a fresh Emacs within tha= t same along the lines of:

~~~~~~
mkdir = /tmp/emacs
TZ=3DAmerica/Chicago HOME=3D/tmp/emacs /path/to/emacs<= /div>
~~~~~~

I *think* setting TZ to a non-UTC= time zone is important to reproduce this.

2. Inst= all latest org-mode from Git.=C2=A0 I did this via package-install-file on = a package I built from a Git checkout of the org-mode repository.

3. Open an org-mode buffer, e.g. C-x C-f ~/test.org RET.

4. Insert:

~~~~~~
#+BEGIN: clocktable :maxlevel 2 :scop= e file :step day :tstart "<2017-07-02 Sun>" :tend "<= ;2017-07-09 Sun>"
#+END:
~~~~~~

5. Save the buffer.

6. Move point = to the start of that dblock and C-c C-c to update it.

<= div>Expected results: First step is "Daily report: [2017-07-02 Sun]&qu= ot; which matches the :tstart.

Actual results: Fir= st step is "Daily report: [2017-07-01 Sat]", the day before the := tstart date.=C2=A0 The last step is also 2017-07-07, not 2017-07-08 as I wa= s expecting.

I notice that as of=C2=A0112c5ba479d,= org-clocktable-steps parses :tstart and :tend with the ZONE argument to or= g-parse-time-string as T.=C2=A0 I think this is causing org-parse-time-stri= ng to parse these user-entered dates as UTC rather than the user's loca= l time as I would have expected.=C2=A0 Changing org-clocktable-steps from d= oing=C2=A0(org-parse-time-string ts nil t) to=C2=A0(org-parse-time-string t= s nil nil), and then the same for te as well, seems to fix this problem.

But time/date math is hard, and this is just a guess= as to where the problem might lie.

Emacs =C2= =A0: GNU Emacs 25.2.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version= 10.11.6 (Build 15G1421))
=C2=A0of 2017-04-24
Package: = Org mode version 9.0.9 (9.0.9-636-gd39ccc-elpaplus @ /tmp/emacs/.emacs.d/el= pa/org-plus-contrib-20170709/)

current state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(setq
= =C2=A0org-src-lang-modes '(("sclang" . sclang) ("ocaml&q= uot; . tuareg)
=C2=A0 = =C2=A0 =C2=A0("elisp" . emacs-lisp) ("ditaa" . artist)<= /div>
=C2=A0 =C2=A0 =C2=A0(&q= uot;asymptote" . asy) ("dot" . fundamental)
=C2=A0 =C2=A0 =C2=A0("sqlite"= . sql) ("calc" . fundamental) ("C" . c)
=C2=A0 =C2=A0 =C2=A0("cpp" = . c++) ("C++" . c++) ("screen" . shell-script)
=C2=A0 =C2=A0 =C2=A0("shel= l" . sh) ("bash" . sh))
=C2=A0org-tab-first-hook &= #39;(org-babel-hide-result-toggle-maybe
=C2=A0 =C2=A0 =C2=A0org-babel-header-arg-expand)
=C2=A0org-speed-command-hook '(org-speed-command-activate
=C2=A0org-babel-speed-command-acti= vate)
=C2=A0org-occur-hook '(org-first-headline-recenter)
=C2=A0org-metaup-hook '(org-babel-load-in-session-maybe)
=C2=A0org-html-format-drawer-function '(closure
=C2=A0 (htmlize-buffer-places
<= span style=3D"white-space:pre"> =C2=A0 =C2=A0org-html-format-tab= le-no-css
=C2=A0 =C2= =A0htmlize-css-name-prefix
=C2=A0 =C2=A0htmlize-output-type htmlize-output-type
=C2=A0 =C2=A0htmlize-css-name-prefix = t)
=C2=A0 (_name cont= ents) contents)
=C2=A0org-latex-format-inlinetask-function 'o= rg-latex-format-inlinetask-default-function
=C2=A0org-confirm-she= ll-link-function 'yes-or-no-p
=C2=A0org-ascii-format-inlineta= sk-function 'org-ascii-format-inlinetask-default
=C2=A0org-la= tex-format-headline-function 'org-latex-format-headline-default-functio= n
=C2=A0org-after-todo-state-change-hook '(org-clock-out-if-c= urrent)
=C2=A0org-latex-format-drawer-function '(closure (t) = (_ contents) contents)
=C2=A0org-odt-format-headline-function = 9;org-odt-format-headline-default-function
=C2=A0org-src-mode-hoo= k '(org-src-babel-configure-edit-buffer
=C2=A0 =C2=A0 org-src-mode-configure-edit-buffer)
=C2=A0org-agenda-before-write-hook '(org-agenda-add-entry-text)
=C2=A0org-babel-pre-tangle-hook '(save-buffer)
=C2= =A0org-mode-hook '(#[0 "\300\301\302\303\304$\207"
= =C2=A0 [add-hook change-major-mod= e-hook org-show-block-all append
= =C2=A0 =C2=A0local]
<= /span> =C2=A0 5]
#[0 &q= uot;\300\301\302\303\304$\207"
=C2=A0 [add-hook change-major-mode-hook org-babel-show-result-= all
=C2=A0 =C2=A0append= local]
=C2=A0 5]
=
(closure
=C2=A0(org-inlinetask-min-level buffer-fac= e-mode-face org-mode-map
=C2=A0 org-tbl-menu org-org-menu org-struct-menu org-entities
<= span style=3D"white-space:pre"> =C2=A0 org-last-state org-id-track= -globally org-clock-start-time
= =C2=A0 texmathp-why remember-data-file
=C2=A0 org-agenda-tags-todo-honor-ignore-options
=C2=A0 iswitchb-temp-bufl= ist align-mode-rules-list
=C2=A0 org-emphasis-alist org-emphasis-regexp-components
=C2=A0 org-export-registered-backends = org-modules
=C2=A0 org-= babel-load-languages ffap-url-regexp t)
=C2=A0nil
=C2=A0(add-hook (quote change-major-mode-hook)
=C2=A0 (quote org-show-block-all) (quote append= ) (quote local))
=C2=A0= )
(closure
=C2=A0(org-bracket-link-regexp org-= src-window-setup *this*
= =C2=A0 org-babel-confirm-evaluate-answer-no
=C2=A0 org-src-preserve-indentation org-src-lang-mode= s
=C2=A0 org-edit-src-c= ontent-indentation org-babel-library-of-babel
=C2=A0 t)
= =C2=A0nil
=C2= =A0(add-hook (quote change-major-mode-hook)
=C2=A0 (quote org-babel-show-result-all) (quote append= )
=C2=A0 (quote local))=
=C2=A0)
org-babel-result-hide-spec org-babel-= hide-all-hashes
org-eld= oc-load)
=C2=A0org-bibtex-headline-format-function '(closure<= /div>
=C2=A0 =C2=A0 =C2=A0 = (org-agenda-search-view-always-boolean
org-agenda-overriding-header t)
=C2=A0 =C2=A0 =C2=A0 (entry) (cdr (assq :title= entry)))
=C2=A0org-archive-hook '(org-attach-archive-delete-= maybe)
=C2=A0org-ascii-format-drawer-function '(closure (t) (= _name contents _width)
=C2=A0 =C2=A0contents)
=C2=A0org-odt-format-inlinetask-function= 'org-odt-format-inlinetask-default-function
=C2=A0org-cycle-= hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
=C2=A0org-cycle-show-empty-line= s
=C2=A0org-optimize-wi= ndow-after-visibility-change)
=C2=A0org-confirm-elisp-link-functi= on 'yes-or-no-p
=C2=A0org-metadown-hook '(org-babel-pop-t= o-session-maybe)
=C2=A0org-odt-format-drawer-function '(closu= re
=C2=A0(hfy-user-sh= eet-assoc hfy-html-quote-regex
= =C2=A0 hfy-html-quote-map hfy-face-to-css
=C2=A0 hfy-begin-span-handler hfy-end-span= -handler
=C2=A0 archi= ve-zip-extract
=C2=A0= nxml-auto-insert-xml-declaration-flag t)
=C2=A0(_name contents) contents)
=C2=A0org-h= tml-format-headline-function 'org-html-format-headline-default-function=
=C2=A0org-link-parameters '(("rmail" :follow org-r= mail-open :store
org-rm= ail-store-link)
=C2=A0 = =C2=A0 =C2=A0 ("mhe" :follow org-mhe-open :store org-mhe-store-li= nk)
=C2=A0 =C2=A0 =C2= =A0 ("irc" :follow org-irc-visit :store org-irc-store-link)
=
=C2=A0 =C2=A0 =C2=A0 ("= info" :follow org-info-open :export org-info-export
:store org-info-store-link)
=C2=A0 =C2=A0 =C2=A0 ("gnus&quo= t; :follow org-gnus-open :store
= org-gnus-store-link)
<= /span> =C2=A0 =C2=A0 =C2=A0 ("docview" :follow org-docview-open := export
org-docview-expo= rt :store org-docview-store-link)
=C2=A0 =C2=A0 =C2=A0 ("bbdb" :follow org-bbdb-open :ex= port org-bbdb-export
:c= omplete org-bbdb-complete-link :store
org-bbdb-store-link)
=C2=A0 =C2=A0 =C2=A0 ("w3m" :store org-w3m-store-lin= k)
=C2=A0 =C2=A0 =C2=A0= ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
=C2=A0 =C2=A0 =C2=A0 ("id" :follow= org-id-open) ("file+sys") ("file+emacs")
=C2=A0 =C2=A0 =C2=A0 ("doi"= ; :follow org--open-doi-link)
<= /span> =C2=A0 =C2=A0 =C2=A0 ("elisp" :follow org--open-elisp-link= )
=C2=A0 =C2=A0 =C2=A0 = ("file" :complete org-file-complete-link)
=C2=A0 =C2=A0 =C2=A0 ("ftp" :follo= w
(lambda (path) (brows= e-url (concat "ftp:" path))))
=C2=A0 =C2=A0 =C2=A0 ("help" :follow org--open-h= elp-link)
=C2=A0 =C2=A0= =C2=A0 ("http" :follow
(lambda (path) (browse-url (concat "http:" path))))
=C2=A0 =C2=A0 =C2=A0 (&qu= ot;https" :follow
= (lambda (path) (browse-url (concat "https:" path))))
=C2=A0 =C2=A0 =C2=A0 ("mailto&= quot; :follow
(lambda (= path) (browse-url (concat "mailto:" path))))
=C2=A0 =C2=A0 =C2=A0 ("news" :fol= low
(lambda (path) (bro= wse-url (concat "news:" path))))
=C2=A0 =C2=A0 =C2=A0 ("shell" :follow org--op= en-shell-link))
=C2=A0org-html-format-inlinetask-function 'or= g-html-format-inlinetask-default-function
=C2=A0org-clock-out-hoo= k '(org-clock-remove-empty-clock-drawer)
=C2=A0)
<= div>
Regards,
Dale
--f403045eb616d519dc0553e891d4--