time-exts-2.0.0: Efficient Timestamps

Safe HaskellNone

Data.Time.Exts.Base

Contents

Description

Basic definitions, including type classes, datatypes and functions.

Synopsis

Classes

class Date d whereSource

Methods

fromDateStruct :: DateStruct -> dSource

Compose a timestamp from date components.

toDateStruct :: d -> DateStructSource

Decompose a timestamp into date components.

class (Date dt, Time dt) => DateTime dt whereSource

Methods

fromDateTimeStruct :: DateTimeStruct -> dtSource

Compose a timestamp from date and time components.

toDateTimeStruct :: dt -> DateTimeStructSource

Decompose a timestamp into date and time components.

class Zone dz => DateZone dz whereSource

Methods

fromDateZoneStruct :: DateZoneStruct -> dzSource

Compose a timestamp from date and time zone components.

toDateZoneStruct :: dz -> DateZoneStructSource

Decompose a timestamp into date and time zone components.

class Zone tz => TimeZone tz whereSource

Methods

fromTimeZoneStruct :: TimeZoneStruct -> tzSource

Compose a timestamp from time and time zone components.

toTimeZoneStruct :: tz -> TimeZoneStructSource

Decompose a timestamp into time and time zone components.

class DateZone dtz => DateTimeZone dtz whereSource

Methods

fromDateTimeZoneStruct :: DateTimeZoneStruct -> dtzSource

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

toDateTimeZoneStruct :: dtz -> DateTimeZoneStructSource

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

class DateTimeMath x c whereSource

Methods

plus :: x -> c -> xSource

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 UnixTimePicos Picos 
DateTimeMath UnixTimePicos Nanos 
DateTimeMath UnixTimePicos Micros 
DateTimeMath UnixTimePicos Millis 
DateTimeMath UnixTimePicos Second 
DateTimeMath UnixTimePicos Minute 
DateTimeMath UnixTimePicos Hour 
DateTimeMath UnixTimeNanos Nanos 
DateTimeMath UnixTimeNanos Micros 
DateTimeMath UnixTimeNanos Millis 
DateTimeMath UnixTimeNanos Second 
DateTimeMath UnixTimeNanos Minute 
DateTimeMath UnixTimeNanos Hour 
DateTimeMath UnixTimeMicros Micros 
DateTimeMath UnixTimeMicros Millis 
DateTimeMath UnixTimeMicros Second 
DateTimeMath UnixTimeMicros Minute 
DateTimeMath UnixTimeMicros Hour 
DateTimeMath UnixTimeMillis Millis 
DateTimeMath UnixTimeMillis Second 
DateTimeMath UnixTimeMillis Minute 
DateTimeMath UnixTimeMillis Hour 
DateTimeMath UnixTime Second 
DateTimeMath UnixTime Minute 
DateTimeMath UnixTime Hour 
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 Duration x c whereSource

Methods

duration :: x -> x -> cSource

Compute the date or time component duration between two timestamps.

Instances

Duration UnixDateTimePicos Picos 
Duration UnixDateTimePicos Nanos 
Duration UnixDateTimePicos Micros 
Duration UnixDateTimePicos Millis 
Duration UnixDateTimePicos Second 
Duration UnixDateTimePicos Minute 
Duration UnixDateTimePicos Hour 
Duration UnixDateTimePicos Day 
Duration UnixDateTimeNanos Nanos 
Duration UnixDateTimeNanos Micros 
Duration UnixDateTimeNanos Millis 
Duration UnixDateTimeNanos Second 
Duration UnixDateTimeNanos Minute 
Duration UnixDateTimeNanos Hour 
Duration UnixDateTimeNanos Day 
Duration UnixDateTimeMicros Micros 
Duration UnixDateTimeMicros Millis 
Duration UnixDateTimeMicros Second 
Duration UnixDateTimeMicros Minute 
Duration UnixDateTimeMicros Hour 
Duration UnixDateTimeMicros Day 
Duration UnixDateTimeMillis Millis 
Duration UnixDateTimeMillis Second 
Duration UnixDateTimeMillis Minute 
Duration UnixDateTimeMillis Hour 
Duration UnixDateTimeMillis Day 
Duration UnixDateTime Second 
Duration UnixDateTime Minute 
Duration UnixDateTime Hour 
Duration UnixDateTime Day 
Duration UnixTimePicos Picos 
Duration UnixTimePicos Nanos 
Duration UnixTimePicos Micros 
Duration UnixTimePicos Millis 
Duration UnixTimePicos Second 
Duration UnixTimePicos Minute 
Duration UnixTimePicos Hour 
Duration UnixTimeNanos Nanos 
Duration UnixTimeNanos Micros 
Duration UnixTimeNanos Millis 
Duration UnixTimeNanos Second 
Duration UnixTimeNanos Minute 
Duration UnixTimeNanos Hour 
Duration UnixTimeMicros Micros 
Duration UnixTimeMicros Millis 
Duration UnixTimeMicros Second 
Duration UnixTimeMicros Minute 
Duration UnixTimeMicros Hour 
Duration UnixTimeMillis Millis 
Duration UnixTimeMillis Second 
Duration UnixTimeMillis Minute 
Duration UnixTimeMillis Hour 
Duration UnixTime Second 
Duration UnixTime Minute 
Duration UnixTime Hour 
Duration UnixDate Day 
Duration LocalDateTimePicos Picos 
Duration LocalDateTimePicos Nanos 
Duration LocalDateTimePicos Micros 
Duration LocalDateTimePicos Millis 
Duration LocalDateTimePicos Second 
Duration LocalDateTimeNanos Nanos 
Duration LocalDateTimeNanos Micros 
Duration LocalDateTimeNanos Millis 
Duration LocalDateTimeNanos Second 
Duration LocalDateTimeMicros Micros 
Duration LocalDateTimeMicros Millis 
Duration LocalDateTimeMicros Second 
Duration LocalDateTimeMillis Millis 
Duration LocalDateTimeMillis Second 
Duration LocalDateTime Second 
Duration LocalDate Day 

Structs

data TimeStruct Source

A struct with time components.

Constructors

TimeStruct 

Fields

_t_hour :: !Hour
 
_t_min :: !Minute
 
_t_sec :: !Double
 

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 -> DaySource

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

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

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

midnightToTime :: Hour -> Minute -> Second -> SecondSource

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

Utilities

isLeapYear :: Year -> BoolSource

Check if the given year is a leap year.

showPeriod :: Hour -> StringSource

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

showSuffix :: Day -> StringSource

Show the suffix of the given day of the month.