emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Bug: clocktable interprets tstart/tend incorrectly, maybe? [9.0.9 (9


From: Dale Sedivec
Subject: [O] 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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]