hourglass-0.2.10: simple performant time related library

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Safe HaskellNone
LanguageHaskell2010

Time.Types

Contents

Description

Basic times units and types.

While pratically some units could hold infinite values, for practical and efficient purpose they are limited to int64 types for seconds and int types for years.

Most units use the unix epoch referential, but by no means reduce portability. the unix referential works under the Windows platform or any other platforms.

Synopsis

Time units

newtype Seconds Source

Number of seconds without a referential.

Can hold a number between [-2^63,2^63-1], which should be good for some billions of years.

However, because of limitation in the calendar conversion currently used, seconds should be in the range [-2^55,2^55-1], which is good for only 1 billion of year.

Constructors

Seconds Int64 

class TimeInterval i where Source

Represent any time interval that has an equivalent value to a number of seconds.

Time enumeration

Timezone

newtype TimezoneOffset Source

Offset against UTC in minutes to obtain from UTC time, local time.

  • a positive number represent a location East of UTC.
  • a negative number represent a location West of UTC.

LocalTime t (-300) = t represent a time at UTC-5 LocalTime t (+480) = t represent a time at UTC+8

should be between -11H and +14H

Example: in AUSEDT (UTC+1000 with daylight = UTC+1100), local time is 15:47; Thus, UTC time is 04:47, and TimezoneOffset is +660 (minutes)

Constructors

TimezoneOffset 

Fields

timezoneOffsetToMinutes :: Int

return the number of minutes

timezoneOffsetToSeconds :: TimezoneOffset -> Seconds Source

Return the number of seconds associated with a timezone

timezone_UTC :: TimezoneOffset Source

The UTC timezone. offset of 0

Computer friendly format

Unix elapsed

Human friendly format

Calendar time

data Date Source

human date representation using common calendar

Constructors

Date 

Fields

dateYear :: !Int

year (Common Era)

dateMonth :: !Month

month of the year

dateDay :: !Int

day of the month, between 1 to 31

data TimeOfDay Source

human time representation of hour, minutes, seconds in a day.

Constructors

TimeOfDay 

Fields

todHour :: !Hours

hours, between 0 and 23

todMin :: !Minutes

minutes, between 0 and 59

todSec :: !Seconds

seconds, between 0 and 59. 60 when having leap second */

todNSec :: !NanoSeconds

nanoseconds, between 0 and 999999999 */