The patch adresses two issues with the function recur_item_find ocurrence(), one major: mktime(), and one minor: item duration. In addition, some refactoring is done. The following recurrent appointments demonstrate the problems (as described in the message) and are used as test cases in the associated test commit. 03/29/2019 @ 12:00 -> 03/30/2019 @ 11:00 {2D -> 04/03/2019} |two-day - every other day - not on 1/4 03/31/2019 @ 12:00 -> 03/31/2019 @ 13:00 {1D -> 04/01/2019} |daily - not on 31/3, twice on 1/4 03/31/2019 @ 04:00 -> 03/31/2019 @ 05:00 {1W} |weekly - appears after one week 03/31/2019 @ 12:00 -> 03/31/2019 @ 12:00 {1M} |monthly - never appears 03/31/2019 @ 12:00 -> 03/31/2019 @ 12:00 {1Y} |yearly - never appears 10/20/2019 @ 00:00 -> 10/21/2019 @ 01:00 {1W -> 11/03/2019} |25 hours - ends on 27th, but continues on 28th 03/24/2019 @ 00:00 -> 03/25/2019 @ 00:00 {1W -> 04/07/2019} |24 hours - does not continue on April 1 The root cause is two mktime() calls in recur_item_find_occurrence(), both of which use an inherited tm_isdst value in the tm structure. In such cases mktime() will "normalize" the tm stucture if tm_isdst is 0 or 1 and in disagreement with the rest of the tm contents (just like 32 May will be normalized to 1 June). Example. In 2019 DST started on 31/3 at 02:00:00 (in the European Union). If the (local) time "31/3/2018 00:00:00" is passed to mktime() with tm_isdst = 0, the return value is (say) T sec and the tm structure is unchanged, because DST is not in effect at midnight. If the same call is performed with tm_isdst = 1, the return value becomes (T - 3600) sec and the tm structure is normalized to "30/3/2018 23:00:00", tm_isdst = 0. In recur_item_find_occurrence(), the normalized tm structure with wrong day and time is used in ensuing calculations, leading to wrong dates and the errors observed. The first mktime() call is used to calculate the "day span" of the occurrence before the occurrence itself has been determined. But once the occurence is known, the "day span" is easily determined, and there is no need for the first mktime() call. Events have no explicit duration. However, recur_event_find_occurrence() and recur_event_inday() set the duration of an event to DAYINSEC before passing it on to recur_item_find_occurrence(). The value is not correct on the day when DST begins or ends. The interpretation of the daylength should be left to the called function. Hence, duration is set to -1 to signal no (explicit) duration. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
calcurse
Building
Install the following build dependencies. If your distro segments development files from core packages (i.e., *-devel or *-dev packages), you may need to install those as well:
- gcc
- automake
- asciidoc
- gettext with development files
- ncurses with development files
If you are using a release tarball, the following commands can be used to build and install calcurse:
$ ./configure
$ make
$ make install
Note that make install
needs to be run as root. When working on a Git
checkout, you need to run ./autogen.sh
before ./configure
.
Package Overview
build-aux
: auxiliary files for the build processcontrib
: useful tools such as hooks or the CalDAV synchronization scriptdoc
: detailed documentation in plain text and HTMLpo
: translations and i18n-related filesscripts
: additional official scripts, such ascalcurse-upgrade
src
: the actual calcurse source filestest
: test suite and test cases for calcurse
Authors
calcurse was originally authored by Frederic Culot and is currently maintained by Lukas Fleischer.
Of course, there are numerous other contributors. Check the Git commit log and
the Thanks
section in the manual for a list of people who have contributed by
reporting bugs, sending fixes, or suggesting improvements.
Contributing and Donations
Patches, bug reports and other requests are always welcome! You can submit them to one of our mailing lists (check the patch submission guidelines for details) or via GitHub.
We are also extremely grateful for donations which help us continue developing calcurse as open source software and are used to cover recurring costs, such as for our servers. You can use https://calcurse.org/donate/ for a one-time payment. If you prefer another form of donation, do not hesitate to contact us!