timelike-time-0.1.1: Timelike interface for the time library

CopyrightCopyright 2016 Ertugrul Söylemez
LicenseApache License 2.0
MaintainerErtugrul Söylemez <esz@posteo.de>
Safe HaskellSafe



This module defines orphan instances for UTCTime and ZonedTime. You should import it with an empty import list to make your intentions explicit about the otherwise unused import:

import Data.Time.Class
import Data.Time.Class.Time ()

Note that one second of time as measured by this library may take zero or two seconds of real time because of leap seconds.

If you use dateSkip and the day had a leap second, there is no way to predict whether the new date will have one as well. This library handles that by assuming that it won't and scaling the day from 86401 seconds to 86400.

The ZonedTime instances go through UTCTime to do basic arithmetic, but use local time for unit-aware arithmetic, such that skipping to the next day actually skips to local midnight. However, keep in mind that in some areas of the world time zones may be switched automatically and spontaneously (daylight savings time).

In time arithmetic it is important to understand the difference between waiting for a duration of time and waiting for a certain point in time. Which one you do depends on the application. For example if you're writing a Cron daemon, you should be prepared to handle the fact that the meaning of "3:00 AM" may change suddenly. Ideally when dealing with user-specified local time allow them to specify the time zone as well.

If you're writing a tea timer or any other duration-sensitive application, do not use local time. Ideally do not use this library at all. The clock library along with its <http://hackage.haskell.org/package/timelike-clock timelike interface> is more suitable in this case.