time-exts-1.1.0: Efficient Timestamps

Safe HaskellNone
LanguageHaskell2010

Data.Time.Exts.Base

Contents

Description

Basic definitions, including type classes, datatypes and functions.

Synopsis

Classes

class Date d where Source

Methods

fromDateStruct :: DateStruct -> d Source

Compose a timestamp from date components.

toDateStruct :: d -> DateStruct Source

Decompose a timestamp into date components.

class Date dt => DateTime dt where Source

Methods

fromDateTimeStruct :: DateTimeStruct -> dt Source

Compose a timestamp from date and time components.

toDateTimeStruct :: dt -> DateTimeStruct Source

Decompose a timestamp into date and time components.

class DateZone dz where Source

Methods

fromDateZoneStruct :: DateZoneStruct -> dz Source

Compose a timestamp from date and time zone components.

toDateZoneStruct :: dz -> DateZoneStruct Source

Decompose a timestamp into date and time zone components.

class DateZone dtz => DateTimeZone dtz where Source

Methods

fromDateTimeZoneStruct :: DateTimeZoneStruct -> dtz Source

Compose a timestamp from date, time and time zone components.

toDateTimeZoneStruct :: dtz -> DateTimeZoneStruct Source

Decompose a timestamp into date, time and time zone components.

class DateTimeMath x c where Source

Methods

plus :: x -> c -> x Source

Add a timestamp with a date or time component.

Instances

DateTimeMath UnixDateTimePicos Picos 
DateTimeMath UnixDateTimePicos Nanos 
DateTimeMath UnixDateTimePicos Micros 
DateTimeMath UnixDateTimePicos Millis 
DateTimeMath UnixDateTimePicos Second 
DateTimeMath UnixDateTimePicos Minute 
DateTimeMath UnixDateTimePicos Hour 
DateTimeMath UnixDateTimePicos Day 
DateTimeMath UnixDateTimeNanos Nanos 
DateTimeMath UnixDateTimeNanos Micros 
DateTimeMath UnixDateTimeNanos Millis 
DateTimeMath UnixDateTimeNanos Second 
DateTimeMath UnixDateTimeNanos Minute 
DateTimeMath UnixDateTimeNanos Hour 
DateTimeMath UnixDateTimeNanos Day 
DateTimeMath UnixDateTimeMicros Micros 
DateTimeMath UnixDateTimeMicros Millis 
DateTimeMath UnixDateTimeMicros Second 
DateTimeMath UnixDateTimeMicros Minute 
DateTimeMath UnixDateTimeMicros Hour 
DateTimeMath UnixDateTimeMicros Day 
DateTimeMath UnixDateTimeMillis Millis 
DateTimeMath UnixDateTimeMillis Second 
DateTimeMath UnixDateTimeMillis Minute 
DateTimeMath UnixDateTimeMillis Hour 
DateTimeMath UnixDateTimeMillis Day 
DateTimeMath UnixDateTime Second 
DateTimeMath UnixDateTime Minute 
DateTimeMath UnixDateTime Hour 
DateTimeMath UnixDateTime Day 
DateTimeMath UnixDate Day 
DateTimeMath LocalDateTimePicos Picos 
DateTimeMath LocalDateTimePicos Nanos 
DateTimeMath LocalDateTimePicos Micros 
DateTimeMath LocalDateTimePicos Millis 
DateTimeMath LocalDateTimePicos Second 
DateTimeMath LocalDateTimeNanos Nanos 
DateTimeMath LocalDateTimeNanos Micros 
DateTimeMath LocalDateTimeNanos Millis 
DateTimeMath LocalDateTimeNanos Second 
DateTimeMath LocalDateTimeMicros Micros 
DateTimeMath LocalDateTimeMicros Millis 
DateTimeMath LocalDateTimeMicros Second 
DateTimeMath LocalDateTimeMillis Millis 
DateTimeMath LocalDateTimeMillis Second 
DateTimeMath LocalDateTime Second 
DateTimeMath LocalDate Day 

class Zone x where Source

Methods

rezone :: x -> TimeZone -> x Source

Change the time zone of a timestamp.

Structs

Components

Fractions

properFracMillis :: Floating a => RealFrac a => a -> (Second, Millis) Source

Decompose a floating point number into second and millisecond components.

properFracMicros :: Floating a => RealFrac a => a -> (Second, Micros) Source

Decompose a floating point number into second and microsecond components.

properFracNanos :: Floating a => RealFrac a => a -> (Second, Nanos) Source

Decompose a floating point number into second and nanosecond components.

properFracPicos :: Floating a => RealFrac a => a -> (Second, Picos) Source

Decompose a floating point number into second and picosecond components.

Durations

epochToDate :: Year -> Month -> Day -> Day Source

Calculate the number of days that have elapsed between Unix epoch and the given date.

epochToTime :: Year -> Month -> Day -> Hour -> Minute -> Second -> Second Source

Calculate the number of seconds (excluding leap seconds) that have elapsed between Unix epoch and the given time.

Utilities

isLeapYear :: Year -> Bool Source

Check if the given year is a leap year.

showPeriod :: Hour -> String Source

Show the pariod (ante or post meridiem) of the given hour.

showSuffix :: Day -> String Source

Show the suffix of the given day of the month.