MichaelXavier / cron

Cron data structure and parser for Haskell
Other
53 stars 33 forks source link

The leap second caused a scheduled job to run twice #30

Open bdesham opened 7 years ago

bdesham commented 7 years ago

I have a job that is scheduled to run at 0 0 1 * *, i.e. at midnight at the beginning of each month. This worked as expected until this past January 1, when the job ran twice. PostgreSQL reports that the task ran at the following times:

For comparison, the most recent normal run happened at 2016-12-01 00:00:00.006968+00.

I assume that the culprit was the leap second that was inserted at the end of 2016-12-31: there was a 23:59:60 on that day.

This happened under Ubuntu 14.04.5. The machine uses NTP (with, I believe, whatever the default Ubuntu configuration is) to keep its time in sync.

sorki commented 6 years ago

At least for chrony this behavior is actually configurable - see https://chrony.tuxfamily.org/doc/2.4/chrony.conf.html#leapsecmode

bdesham commented 6 years ago

Is chrony related to this cron library somehow, or are you just pointing out a possible future feature? 🙂

sorki commented 6 years ago

Not really - I'm just trying to point out that the behavior of step seconds is configurable in NTP daemon. Chronyd is just a replacement for NTPD which I'm very happy with for a long time.

MichaelXavier commented 6 years ago

BTW there's no chance I'm going to work on this bug fix any time soon but I'd be happy to take a PR.