* Computed negative CLOCK time 1 hour off
@ 2008-10-16 15:24 Chris Leyon
2008-10-16 16:39 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Chris Leyon @ 2008-10-16 15:24 UTC (permalink / raw
To: emacs-orgmode
When Org automatically computes a time interval which is negative, it
is off by 1 hour. (This may or may not be related to Chris Willard's
"1 hour earlier" problem.) Positive time intervals seem okay. I'm
using 6.08c on GNU Emacs 22.1.
To reproduce: emacs -Q
Start with this line:
CLOCK: [2008-10-16 Thu 10:00]--[2008-10-16 Thu 10:00] => 0:00
Position point over the "00" in the second timestamp. Press S-down. See
CLOCK: [2008-10-16 Thu 10:00]--[2008-10-16 Thu 09:55] => -1:55
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Computed negative CLOCK time 1 hour off
2008-10-16 15:24 Computed negative CLOCK time 1 hour off Chris Leyon
@ 2008-10-16 16:39 ` Carsten Dominik
2008-10-17 2:03 ` Chris Leyon
0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2008-10-16 16:39 UTC (permalink / raw
To: Chris Leyon; +Cc: emacs-orgmode
Hi Chris,
what could possibly be the purpose of a negative time range? Are you
working for a secret government agency?
:-)
- Carsten
On Oct 16, 2008, at 5:24 PM, Chris Leyon wrote:
> When Org automatically computes a time interval which is negative, it
> is off by 1 hour. (This may or may not be related to Chris Willard's
> "1 hour earlier" problem.) Positive time intervals seem okay. I'm
> using 6.08c on GNU Emacs 22.1.
>
> To reproduce: emacs -Q
>
> Start with this line:
> CLOCK: [2008-10-16 Thu 10:00]--[2008-10-16 Thu 10:00] => 0:00
>
> Position point over the "00" in the second timestamp. Press S-
> down. See
> CLOCK: [2008-10-16 Thu 10:00]--[2008-10-16 Thu 09:55] => -1:55
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Computed negative CLOCK time 1 hour off
2008-10-16 16:39 ` Carsten Dominik
@ 2008-10-17 2:03 ` Chris Leyon
2008-10-17 5:27 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Chris Leyon @ 2008-10-17 2:03 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 701 bytes --]
There is a precedent in the Emacs manual -- Appendix E, Antinews: "For
those users who live backwards in time [...]"
:-)
I admit there may not be great practical utility in a negative time
range. But the interval is well-defined so it ought to be computed
correctly. I would say that a wrong answer is worse than no answer
since it may be believed correct at first glance, when it is not.
Anyway, I'm including a patch for 6.09 which seems to fix the problem....
On Thu, Oct 16, 2008 at 12:39 PM, Carsten Dominik
<dominik@science.uva.nl> wrote:
> Hi Chris,
>
> what could possibly be the purpose of a negative time range? Are you
> working for a secret government agency?
>
> :-)
>
> - Carsten
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: neg-time.patch --]
[-- Type: text/x-patch; name=neg-time.patch, Size: 635 bytes --]
--- /home/cleyon/u/share/emacs/site-lisp/org-6.09/lisp/org.el 2008-10-09 10:25:12.000000000 -0400
+++ org.el 2008-10-16 21:57:45.000000000 -0400
@@ -2511,11 +2511,12 @@
(apply 'encode-time (org-parse-time-string te)))
(time-to-seconds
(apply 'encode-time (org-parse-time-string ts))))
- h (floor (/ s 3600))
+ sign (if (< s 0) "-" "")
+ h (truncate (/ s 3600))
s (- s (* 3600 h))
- m (floor (/ s 60))
+ m (truncate (/ s 60))
s (- s (* 60 s)))
- (insert " => " (format "%2d:%02d" h m))
+ (insert " => " (format "%s%d:%02d" sign (abs h) (abs m)))
t))))))
(defun org-check-running-clock ()
[-- Attachment #3: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Computed negative CLOCK time 1 hour off
2008-10-17 2:03 ` Chris Leyon
@ 2008-10-17 5:27 ` Carsten Dominik
0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2008-10-17 5:27 UTC (permalink / raw
To: Chris Leyon; +Cc: emacs-orgmode
Hi Chris
On Oct 17, 2008, at 4:03 AM, Chris Leyon wrote:
> There is a precedent in the Emacs manual -- Appendix E, Antinews: "For
> those users who live backwards in time [...]"
Great answer. And thanks for the patch. I am applying it.
However, I am sure there are more similar problems, so
I am not at all sure that calculating clock sums, or summing
properties that contain times, will work properly with negative
time intervals. I did not pay any attention to this when writing
those functions, and it is likely that similar problems will exist.
- Carsten
>
>
> :-)
>
> I admit there may not be great practical utility in a negative time
> range. But the interval is well-defined so it ought to be computed
> correctly. I would say that a wrong answer is worse than no answer
> since it may be believed correct at first glance, when it is not.
>
> Anyway, I'm including a patch for 6.09 which seems to fix the
> problem....
>
> On Thu, Oct 16, 2008 at 12:39 PM, Carsten Dominik
> <dominik@science.uva.nl> wrote:
>> Hi Chris,
>>
>> what could possibly be the purpose of a negative time range? Are you
>> working for a secret government agency?
>>
>> :-)
>>
>> - Carsten
> <neg-time.patch>_______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-17 5:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-16 15:24 Computed negative CLOCK time 1 hour off Chris Leyon
2008-10-16 16:39 ` Carsten Dominik
2008-10-17 2:03 ` Chris Leyon
2008-10-17 5:27 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.