Safe Haskell | None |
---|---|
Language | Haskell2010 |
Chronos.Types
Description
Data types for representing different date and time-related information.
Internally, the types Int
and Int64
are used to
represent everything. These are used even when negative
values are not appropriate and even if a smaller fixed-size
integer could hold the information. The only cases when
Int64
is used are when it is neccessary to represent values
with numbers 2^29
or higher. These are typically fields
that represent nanoseconds.
Unlike the types in the venerable time
library, the types
here do not allow the user to work with all dates. Since this
library uses fixed-precision integral values instead of Integer
,
all of the usual problems with overflow should be considered. Notably,
PosixTime
and TaiTime
can only be used to represent time between the years
1680 and 2260. All other types in this library correctly represent time
a million years before or after 1970.
The vector unbox instances, not yet available, will store
data in a reasonably compact manner. For example, the instance
for Day
has three unboxed vectors: Int
for the year, Int8
for the month, and Int8
for the day. This only causes
corruption of data if the user is trying to use out-of-bounds
values for the month and the day. Users are advised to not
use the data types provided here to model non-existent times.
- newtype Day = Day {}
- newtype DayOfWeek = DayOfWeek {
- getDayOfWeek :: Int
- newtype DayOfMonth = DayOfMonth {
- getDayOfMonth :: Int
- newtype DayOfYear = DayOfYear {
- getDayOfYear :: Int
- newtype Month = Month {}
- newtype Year = Year {}
- newtype Offset = Offset {}
- newtype TaiTime = TaiTime {
- getTaiTime :: Int64
- newtype PosixTime = PosixTime {}
- data UtcTime = UtcTime {
- utcTimeDate :: !Day
- utcTimeNanoseconds :: !Int64
- newtype DayOfWeekMatch a = DayOfWeekMatch {
- getDayOfWeekMatch :: Vector a
- newtype MonthMatch a = MonthMatch {
- getMonthMatch :: Vector a
- newtype UnboxedMonthMatch a = UnboxedMonthMatch {}
- newtype Nanoseconds = Nanoseconds {}
- data SubsecondPrecision
- data Date = Date {}
- data OrdinalDate = OrdinalDate {}
- data MonthDate = MonthDate {}
- data Datetime = Datetime {
- datetimeDate :: !Date
- datetimeTime :: !TimeOfDay
- data OffsetDatetime = OffsetDatetime {}
- data TimeOfDay = TimeOfDay {
- timeOfDayHour :: !Int
- timeOfDayMinute :: !Int
- timeOfDayNanoseconds :: !Int64
- data DatetimeFormat = DatetimeFormat {}
- data OffsetFormat
- data DatetimeLocale a = DatetimeLocale {}
- data MeridiemLocale a = MeridiemLocale {
- meridiemLocaleAm :: !a
- meridiemLocalePm :: !a
Documentation
A day represented as the modified Julian date, the number of days since midnight on November 17, 1858.
The day of the week.
Constructors
DayOfWeek | |
Fields
|
newtype DayOfMonth Source #
The day of the month.
Constructors
DayOfMonth | |
Fields
|
Instances
The day of the year.
Constructors
DayOfYear | |
Fields
|
The month of the year.
The number of years elapsed since the beginning of the Common Era.
TAI time with nanosecond resolution.
Constructors
TaiTime | |
Fields
|
POSIX time with nanosecond resolution.
Constructors
PosixTime | |
Fields |
Constructors
UtcTime | |
Fields
|
newtype DayOfWeekMatch a Source #
Constructors
DayOfWeekMatch | |
Fields
|
newtype MonthMatch a Source #
Constructors
MonthMatch | |
Fields
|
newtype UnboxedMonthMatch a Source #
Constructors
UnboxedMonthMatch | |
Fields |
data SubsecondPrecision Source #
The precision used when encoding seconds to a human-readable format.
Constructors
SubsecondPrecisionAuto | Rounds to second, millisecond, microsecond, or nanosecond |
SubsecondPrecisionFixed !Int | Specify number of places after decimal |
A date as represented by the Gregorian calendar.
data OrdinalDate Source #
The year and number of days elapsed since the beginning it began.
Constructors
OrdinalDate | |
Fields |
Instances
A month and the day of the month. This does not actually represent a specific date, since this recurs every year.
Constructors
MonthDate | |
Fields
|
A date as represented by the Gregorian calendar and a time of day.
Constructors
Datetime | |
Fields
|
A time of day with nanosecond resolution.
Constructors
TimeOfDay | |
Fields
|
data DatetimeFormat Source #
Constructors
DatetimeFormat | |
Fields
|
Instances
data OffsetFormat Source #
Formatting settings for a timezone offset.
Constructors
OffsetFormatColonOff |
|
OffsetFormatColonOn |
|
OffsetFormatSecondsPrecision |
|
OffsetFormatColonAuto |
|
data DatetimeLocale a Source #
Locale-specific formatting for weekdays and months. The
type variable will likely be instantiated to Text
or ByteString
.
Constructors
DatetimeLocale | |
Fields
|
data MeridiemLocale a Source #
Locale-specific formatting for AM and PM.
Constructors
MeridiemLocale | |
Fields
|
Instances
Eq a => Eq (MeridiemLocale a) Source # | |
Ord a => Ord (MeridiemLocale a) Source # | |
Read a => Read (MeridiemLocale a) Source # | |
Show a => Show (MeridiemLocale a) Source # | |