emacs-orgmode
[Top][All Lists]
Advanced

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

Re: What is a week?


From: Ihor Radchenko
Subject: Re: What is a week?
Date: Mon, 10 Apr 2023 07:46:38 +0000

Marcin Borkowski <mbork@mbork.pl> writes:

>> Assume it's Sunday.  I create a clock table with :wstart 0 and
>> thisweek - and apparently my clock table starts 7 days ago.
>>
>> Now it's Monday.  I create a clock table with :wstart 1 and thisweek -
>> and my clock table starts today.
>>
>> What is the logic behind it?
>
> To clarify: I understand that the reason is the `if' from this line from
> `org-clock.el':
>
> (setq diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))
>
> (introduced ~10 years ago!).  But why is it coded this way?

The commit goes like

0bca49801eac749b6adf39b176b9455566faac85
Author:     Bastien Guerry <bzg@altern.org>
org-clock.el: Implement a new parameter :wstart to define the week start day

-      (setq diff (+ (* -7 shift) (if (= dow 0) 6 (1- dow)))
+      (setq diff (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))

I am not sure if there is any particular reason.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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