Get the current time from the system clock.
Modulechronos-1.1.6.1Haskell2010
Chronos
Chronos is a performance-oriented time library for Haskell, with a straightforward API. The main differences between this and the time library are:
Chronos uses machine integers where possible. This means that time-related arithmetic should be faster, with the drawback that the types are incapable of representing times that are very far in the future or the past (because Chronos provides nanosecond, rather than picosecond, resolution). For most users, this is not a hindrance.
Chronos provides ToJSON/FromJSON instances for serialisation.
Chronos provides Unbox instances for working with unboxed vectors.
Chronos provides Prim instances for working with byte arrays/primitive arrays.
Chronos uses normal non-overloaded haskell functions for encoding and decoding time. It provides attoparsec parsers for both Text and ByteString. Additionally, Chronos provides functions for encoding time to Text or ByteString. The time library accomplishes these with the Data.Time.Format module, which uses UNIX-style datetime format strings. The approach taken by Chronos is faster and catches more mistakes at compile time, at the cost of being less expressive.
- 25 types
- 212 values
- Packagechronos-1.1.6.1
- Exports237
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceChronos.hs
Functions
0 declarationsCurrent
Gets the current Day. This does not take the user's time zone into account.
Gets the Day of tomorrow.
Gets the Day of yesterday.
Get the current DayOfWeek from the system clock.
Get the yesterday's DayOfWeek from the system clock.
Get the tomorrow's DayOfWeek from the system clock.
The Unix epoch, that is 1970-01-01 00:00:00.
Duration
Measures the time it takes to run an action and evaluate its result to WHNF. This measurement uses a monotonic clock instead of the standard system clock.
Measures the time it takes to run an action. The result is discarded. This measurement uses a monotonic clock instead of the standard system clock.
Construction
datetimeFromYmdhms Construct a Datetime from year, month, day, hour, minute, second:
datetimeFromYmdhms 2014 2 26 17 58 52Datetime {datetimeDate = Date {dateYear = Year {getYear = 2014}, dateMonth = Month {getMonth = 1}, dateDay = DayOfMonth {getDayOfMonth = 26}}, datetimeTime = TimeOfDay {timeOfDayHour = 17, timeOfDayMinute = 58, timeOfDayNanoseconds = 52000000000}}
Construct a Time from year, month, day, hour, minute, second:
timeFromYmdhms 2014 2 26 17 58 52Time {getTime = 1393437532000000000}
Conversion
Convert Time to OffsetDatetime by providing an Offset.
Convert OffsetDatetime to Time.
Convert Time to Day. This function is lossy; consequently, it does not roundtrip with dayToTimeMidnight.
Convert a Day to an OrdinalDate.
Convert an OrdinalDate to a Day.
Build Timespan
A Timespan representing a single second.
A Timespan representing a single minute.
A Timespan representing a single hour.
A Timespan representing a single day.
A Timespan representing a single week.
Matching
Build a DayOfWeekMatch from seven (7) values.
Build a MonthMatch from twelve (12) values.
Build an UnboxedMonthMatch from twelve (12) values.
Match a DayOfWeek against a DayOfWeekMatch.
Match a Month against a MonthMatch.
Match a Month against an UnboxedMonthMatch.
Format
The formats provided is this module are language-agnostic. To find meridiem formats and month formats, look in a language-specific module.
The W3C DatetimeFormat.
encode_YmdHMS SubsecondPrecisionAuto w3c (timeToDatetime (timeFromYmdhms 2014 2 26 17 58 52))"2014-02-26T17:58:52"
\(s :: SubsecondPrecision) (dt :: Datetime) -> isJust (decode_YmdHMS w3c (encode_YmdHMS s w3c dt))A DatetimeFormat that separates the members of the Date by slashes.
encode_YmdHMS SubsecondPrecisionAuto slash (timeToDatetime (timeFromYmdhms 2014 2 26 17 58 52))"2014/02/26 17:58:52"
\(s :: SubsecondPrecision) (dt :: Datetime) -> isJust (decode_YmdHMS slash (encode_YmdHMS s slash dt))A DatetimeFormat that separates the members of the Date by hyphens.
encode_YmdHMS SubsecondPrecisionAuto hyphen (timeToDatetime (timeFromYmdhms 2014 2 26 17 58 52))"2014-02-26 17:58:52"
\(s :: SubsecondPrecision) (dt :: Datetime) -> isJust (decode_YmdHMS hyphen (encode_YmdHMS s hyphen dt))A DatetimeFormat with no separators, except for a
T between the Date and Time.
encode_YmdHMS SubsecondPrecisionAuto compact (timeToDatetime (timeFromYmdhms 2014 2 26 17 58 52))"20140226T175852"
\(s :: SubsecondPrecision) (dt :: Datetime) -> isJust (decode_YmdHMS compact (encode_YmdHMS s compact dt))Months
The Month of January.
The Month of February.
The Month of March.
The Month of April.
The Month of May.
The Month of June.
The Month of July.
The Month of August.
The Month of September.
The Month of October.
The Month of November.
The Month of December.
Days of Week
The DayOfWeek Sunday.
The DayOfWeek Monday.
The DayOfWeek Tuesday.
The DayOfWeek Wednesday.
The DayOfWeek Thursday.
The DayOfWeek Friday.
The DayOfWeek Saturday.
Utility
Return the number of days in a given month.
Is the Year a leap year?
isLeapYear (Year 1996)True
isLeapYear (Year 2019)False
All UTC time offsets. See List of UTC time offsets.
Convert a Timespan to its equivalent in seconds.
Textual Conversion
0 declarationsDate
Text
Given a SubsecondPrecision and a separator, construct a Text Builder corresponding to an Hour/Minute/Second encoding.
Parse a Year/Month/Day-encoded Date that uses the given separator.
Parse a Year/Month/Day-encoded Date that either has no separators or uses any non-numeric character for each separator.
Parse a Month/Day/Year-encoded Date that uses the given separator.
Parse a Month/Day/Year-encoded Date that either has no separators or uses any non-numeric character for each separator.
Parse a Day/Month/Year-encoded Date that uses the given separator.
Parse a Day/Month/Year-encoded Date that either has no separators or uses any non-numeric character for each separator.
UTF-8 ByteString
Given a Date and a separator, construct a ByteString Builder corresponding to a Day/Month/Year encoding.
Parse a Year/Month/Day-encoded Date that uses the given separator.
Time of Day
Text
Given a MeridiemLocale, a SubsecondPrecision, and a separator, construct a Text Builder according to an IMS encoding.
This differs from builder_IMSp in that their is a space between the seconds and locale.
Given a MeridiemLocale, a SubsecondPrecision, and a separator, construct a Text Builder according to an IMS encoding.
Parse an Hour/Minute/Second-encoded TimeOfDay that uses the given separator.
Parses text that is formatted as either of the following:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
UTF-8 ByteString
Given a SubsecondPrecision and a separator, construct a ByteString Builder corresponding to an Hour/Minute/Second encoding of the given TimeOfDay.
Given a MeridiemLocale, a SubsecondPrecision, and a separator, construct a ByteString Builder corresponding to an IMS encoding of the given TimeOfDay. This differs from builderUtf8_IMSp in that there is a space between the seconds and locale.
Given a MeridiemLocale, a SubsecondPrecision, and a separator, construct a ByteString Builder corresponding to an IMS encoding of the given TimeOfDay.
Parse an Hour/Minute/Second-encoded TimeOfDay that uses the given separator.
Parses text that is formatted as either of the following:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Parse a TimeOfDay that was encoded using the given separator.
Datetime
Text
Given a SubsecondPrecision and a DatetimeFormat, construct a Text Builder corresponding to a Day/Month/Year,Hour/Minute/Second encoding of the given Datetime.
Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to a Day/Month/Year,IMS encoding of the given Datetime.
Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to a Day/Month/Year,IMS encoding of the given Datetime. This differs from builder_DmyIMSp in that it adds a space between the locale and seconds.
Given a SubsecondPrecision and a DatetimeFormat, construct a Text Builder corresponding to a Year/Month/Day,Hour/Minute/Second encoding of the given Datetime.
Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder that corresponds to a Year/Month/Day,IMS encoding of the given Datetime.
Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder that corresponds to a Year/Month/Day,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.
Construct a Text Builder corresponding to the W3C encoding of the given Datetime.
Deprecated. This is just a poorly named alias for builderIso8601.
Given a SubsecondPrecision and DatetimeFormat, construct Text that corresponds to a Day/Month/Year,Hour/Minute/Second encoding of the given Datetime.
Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct Text that corresponds to a Day/Month/Year,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.
Given a SubsecondPrecision and DatetimeFormat, construct Text that corresponds to a Year/Month/Day,Hour/Minute/Second encoding of the given Datetime.
Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct Text that corresponds to a Year/Month/Day,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.
Parse a Day/Month/Year,Hour/Minute/Second-encoded Datetime that was encoded with the given DatetimeFormat.
Parses a Year/Month/Day,Hour/Minute/Second-encoded Datetime that was encoded using the given DatetimeFormat.
Parses a Year/Month/Day,Hour/Minute/Second-encoded Datetime that was encoded with either no separators or any non-numeric character for each separator.
Parses a Year/Month/Date,Hour/Minute/Second-encoded Datetime from Text that was encoded with the given DatetimeFormat and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Parses a Year/Month/Date,Hour/Minute/Second-encoded Datetime from Text that was encoded with either no separators or any non-numeric character for each separator and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Parses text that is formatted as either of the following:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Parse a Day/Month/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with either no separators or any non-numeric character for each separator and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Parses a Month/Day/Year,Hour/Minute/Second-encoded Datetime that was encoded using the given DatetimeFormat.
Parses a Month/Day/Year,Hour/Minute/Second-encoded Datetime that was encoded with either no separators or any non-numeric character for each separator.
Parse a Month/Day/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with with the given DatetimeFormat and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is not provided, it is assumed to be zero.
Parse a Month/Day/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with either no separators or any non-numeric character for each separator and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is not provided, it is assumed to be zero.
Parses a Datetime from Text that was encoded with any of the following formats and with either no separators or any non-numeric character for each separator.
%Y-%M-%D %H:%M%Y-%M-%D %H:%M:%S%D-%M-%Y %H:%M%D-%M-%Y %H:%M:%S%M-%D-%Y %H:%M%M-%D-%Y %H:%M:%S
That is, the seconds and subseconds part is optional. If it is not provided, it is assumed to be zero. Note that this is the least performant parser due to backtracking
Decode a Day/Month/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with the given DatetimeFormat.
Decode a Month/Day/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with the given DatetimeFormat.
Decode a Month/Day/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with the given DatetimeFormat and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is not provided, it is assumed to be zero.
Parse a Month/Day/Year,Hour/Minute/Second-encoded Datetime from Text with either no separators or any non-numeric character for each separator and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is not provided, it is assumed to be zero.
Decode a Year/Month/Day,Hour/Minute/Second-encoded Datetime from Text that was encoded with the given DatetimeFormat.
Decode a Year/Month/Date,Hour/Minute/Second-encoded Datetime from Text that was encoded with the given DatetimeFormat and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Decode a Year/Month/Date,Hour/Minute/Second-encoded Datetime from Text that was encoded with either no separators or any non-numeric character for each separator and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Decode a Day/Month/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with with the given DatetimeFormat and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Decode a Day/Month/Year,Hour/Minute/Second-encoded Datetime from Text that was encoded with either no separators or any non-numeric character for each separator and with either of the following time formats:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Parses text that was encoded in DMY, YMD, or MDY format with optional seconds and any non-numeric character as separators.
UTF-8 ByteString
Given a SubsecondPrecision and a DatetimeFormat, construct a ByteString corresponding to a Year/Month/Day,Hour/Minute/Second encoding of the given Datetime.
Given a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a ByteString corresponding to a Year/Month/Day,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.
Given a SubsecondPrecision and a DatetimeFormat, construct a ByteString Builder corresponding to a Year/Month/Day,Hour/Minute/Second encoding of the given Datetime.
Given a SubsecondPrecision and a DatetimeFormat, construct a ByteString Builder corresponding to a Year/Month/Day,IMS encoding of the given Datetime.
Given a SubsecondPrecision and a DatetimeFormat, construct a ByteString Builder corresponding to a Year/Month/Day,IMS encoding of the given Datetime. This inserts a space between the locale and seconds.
Construct a ByteString Builder corresponding to a W3C encoding of the given Datetime.
Decode a Year/Month/Day,Hour/Minute/Second-encoded Datetime from a ByteString.
Parses text that is formatted as either of the following:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Parse a Year/Month/Day,Hour/Minute/Second-encoded Datetime that was encoded using the given DatetimeFormat.
Parses text that is formatted as either of the following:
%H:%M%H:%M:%S
That is, the seconds and subseconds part is optional. If it is
not provided, it is assumed to be zero. This format shows up
in Google Chrome's datetime-local inputs.
Parse a Datetime that was encoded using the given DatetimeFormat.
UTF-8 Bytes
Encode a datetime with ISO-8601. The result does not include any indication of a time zone. If the subsecond part is zero, it is suppressed. Examples of output:
2021-01-05T23:00:51
2021-01-05T23:00:52.123000000
2021-01-05T23:00:53.674094347Decode an ISO-8601-encode datetime.
Decode a datetime that is nearly ISO-8601-encoded but uses a space
instead of a T to separate the date and the time. For example:
2022-10-29 14:00:05.
Short Text
Decode an ISO-8601-encode datetime. The encoded time must be suffixed
by either Z or +00:00 or +00.
Decode an ISO-8601-encode datetime. The encoded time must not be suffixed
by an offset. Any offset (e.g. -05:00, +00:00, Z) will cause a decode
failure.
Offset Datetime
Text
Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct Text corresponding to the Year/Month/Day,Hour/Minute/Second-encoding of the given OffsetDatetime.
Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct Text corresponding to the Day/Month/Year,Hour/Minute/Second encoding of the given OffsetDatetime.
Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to a Year/Month/Day,Hour/Minute/Second encoding of the given OffsetDatetime.
Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to the Day/Month/Year,Hour/Minute/Second-encoding of the given OffsetDatetime.
Parse a Year/Month/Day,Hour/Minute/Second-encoded OffsetDatetime that was encoded using the given OffsetFormat and DatetimeFormat.
Parse a Day/Month/Year,Hour/Minute/Second-encoded OffsetDatetime that was encoded using the given OffsetFormat and DatetimeFormat.
Given an OffsetFormat, a MeridiemLocale, a SubsecondPrecision, and DatetimeFormat, construct a Text Builder corresponding to a Year/Month/Day,IMS-encoding of the given OffsetDatetime.
Given an OffsetFormat, a MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a Text Builder corresponding to the Day/Month/Year,IMS encoding of the given OffsetDatetime.
Construct a Text Builder corresponding to the w3c-formatting of the given OffsetDatetime.
UTF-8 ByteString
Given an OffsetFormat, a SubsecondPrecision, and a DatetimeFormat, construct a ByteString Builder corresponding to the Year/Month/Day,Hour/Minute/Second encoding of the given OffsetDatetime.
Parse a Year/Month/Day,Hour/Minute/Second-encoded OffsetDatetime that was encoded using the given OffsetFormat and DatetimeFormat.
Given an OffsetFormat, a 'MeridiemLocale, a SubsecondPrecision, and a DatetimeFormat, construct a ByteString Builder corresponding to a Year/Month/Day,IMS-encoded OffsetDatetime.
Construct a ByteString Builder corresponding to the W3C encoding of the given Datetime.
UTF-8 Bytes
Consume an ISO-8601-encoded datetime with offset. This will consume any of the following:
2021-12-05T23:01:09Z
2021-12-05T23:01:09.000Z
2021-12-05T23:01:09.123456789Z
2021-12-05T23:01:09+05:00
2021-12-05T23:01:09.357-11:00ShortText
Decode an ISO-8601-encode datetime. The encoded time must include an offset
(e.g. -05:00, +00:00, Z).
Offset
Text
Encode an Offset to Text using the given OffsetFormat.
Construct a Builder corresponding to the given Offset encoded using the given OffsetFormat.
Decode an Offset from Text that was encoded using the given OffsetFormat.
Parse an Offset that was encoded using the given OffsetFormat.
UTF-8 ByteString
Encode an Offset as a ByteString using the given OffsetFormat.
Construct a ByteString Builder corresponding to the encoding of an Offset using the given OffsetFormat.
Decode an Offset from a ByteString that was encoded using the given OffsetFormat.
Parse an Offset that was encoded using the given OffsetFormat.
Timespan
Text
Encode a Timespan as Text using the given SubsecondPrecision.
Construct a Text Builder corresponding to an encoding of the given Timespan using the given SubsecondPrecision.
UTF-8 ByteString
Given a SubsecondPrecision, construct a ByteString corresponding to an encoding of the given Timespan.
Given a SubsecondPrecision, construct a ByteString Builder corresponding to an encoding of the given Timespan.
TimeInterval
Is the given Time within the TimeInterval?
Convert a TimeInterval to a Timespan. This is equivalent to width.
The TimeInterval that covers the entire range of Times that Chronos supports.
\(t :: Time) -> within t wholeThe singleton (degenerate) TimeInterval.
Get the lower bound of the TimeInterval.
Get the upper bound of the TimeInterval.
The width of the TimeInterval. This is equivalent to timeIntervalToTimespan.
A smart constructor for TimeInterval. In general, you should prefer using this
over the TimeInterval constructor, since it maintains the invariant that
lowerBound interval <= upperBound interval.
An infix timeIntervalBuilder.
Types
25 declarationsA day represented as the modified Julian date, the number of days since midnight on November 17, 1858.
Instances12Enum, Eq, Ord, Read, Show, Storable, …
Enum DayDefined in chronos-1.1.6.1 · ChronosEq DayDefined in chronos-1.1.6.1 · ChronosOrd DayDefined in chronos-1.1.6.1 · ChronosRead DayDefined in chronos-1.1.6.1 · ChronosShow DayDefined in chronos-1.1.6.1 · ChronosStorable DayDefined in chronos-1.1.6.1 · ChronosNFData DayDefined in chronos-1.1.6.1 · ChronosHashable DayDefined in chronos-1.1.6.1 · ChronosPrim DayDefined in chronos-1.1.6.1 · ChronosFromJSON DayDefined in chronos-1.1.6.1 · ChronosToJSON DayDefined in chronos-1.1.6.1 · ChronosTorsor Day IntDefined in chronos-1.1.6.1 · Chronos
The day of the week.
Constructors
Instances6Eq, Ord, Read, Show, NFData, Hashable
Eq DayOfWeekDefined in chronos-1.1.6.1 · ChronosOrd DayOfWeekDefined in chronos-1.1.6.1 · ChronosRead DayOfWeekDefined in chronos-1.1.6.1 · ChronosShow DayOfWeekDefined in chronos-1.1.6.1 · ChronosNFData DayOfWeekDefined in chronos-1.1.6.1 · ChronosHashable DayOfWeekDefined in chronos-1.1.6.1 · Chronos
The day of the month.
Constructors
Instances12Enum, Eq, Ord, Read, Show, NFData, …
Enum DayOfMonthDefined in chronos-1.1.6.1 · ChronosEq DayOfMonthDefined in chronos-1.1.6.1 · ChronosOrd DayOfMonthDefined in chronos-1.1.6.1 · ChronosRead DayOfMonthDefined in chronos-1.1.6.1 · ChronosShow DayOfMonthDefined in chronos-1.1.6.1 · ChronosNFData DayOfMonthDefined in chronos-1.1.6.1 · ChronosPrim DayOfMonthDefined in chronos-1.1.6.1 · ChronosUnbox DayOfMonthDefined in chronos-1.1.6.1 · ChronosVector Vector DayOfMonthDefined in chronos-1.1.6.1 · ChronosMVector MVector DayOfMonthDefined in chronos-1.1.6.1 · Chronosdata MVector s DayOfMonthMV_DayOfMonth (MVector s DayOfMonth)
data Vector DayOfMonthV_DayOfMonth (Vector DayOfMonth)
The day of the year.
Constructors
Instances6Eq, Ord, Read, Show, NFData, Prim
Instances13Bounded, Enum, Eq, Ord, Read, Show, …
Bounded MonthDefined in chronos-1.1.6.1 · ChronosMonth starts at 0 and ends at 11 (January to December)
Enum MonthDefined in chronos-1.1.6.1 · ChronosEq MonthDefined in chronos-1.1.6.1 · ChronosOrd MonthDefined in chronos-1.1.6.1 · ChronosRead MonthDefined in chronos-1.1.6.1 · ChronosShow MonthDefined in chronos-1.1.6.1 · ChronosNFData MonthDefined in chronos-1.1.6.1 · ChronosPrim MonthDefined in chronos-1.1.6.1 · ChronosUnbox MonthDefined in chronos-1.1.6.1 · ChronosVector Vector MonthDefined in chronos-1.1.6.1 · ChronosMVector MVector MonthDefined in chronos-1.1.6.1 · Chronosdata MVector s MonthDefined in chronos-1.1.6.1 · Chronosdata Vector MonthDefined in chronos-1.1.6.1 · Chronos
A UTC offset in minutes.
Instances11Enum, Eq, Ord, Read, Show, NFData, …
Enum OffsetDefined in chronos-1.1.6.1 · ChronosEq OffsetDefined in chronos-1.1.6.1 · ChronosOrd OffsetDefined in chronos-1.1.6.1 · ChronosRead OffsetDefined in chronos-1.1.6.1 · ChronosShow OffsetDefined in chronos-1.1.6.1 · ChronosNFData OffsetDefined in chronos-1.1.6.1 · ChronosFromJSON OffsetDefined in chronos-1.1.6.1 · ChronosFromJSONKey OffsetDefined in chronos-1.1.6.1 · ChronosToJSON OffsetDefined in chronos-1.1.6.1 · ChronosToJSONKey OffsetDefined in chronos-1.1.6.1 · ChronosTorsor Offset IntDefined in chronos-1.1.6.1 · Chronos
Instances12Bounded, Eq, Ord, Read, Show, Storable, …
Bounded TimeDefined in chronos-1.1.6.1 · ChronosEq TimeDefined in chronos-1.1.6.1 · ChronosOrd TimeDefined in chronos-1.1.6.1 · ChronosRead TimeDefined in chronos-1.1.6.1 · ChronosShow TimeDefined in chronos-1.1.6.1 · ChronosStorable TimeDefined in chronos-1.1.6.1 · ChronosNFData TimeDefined in chronos-1.1.6.1 · ChronosHashable TimeDefined in chronos-1.1.6.1 · ChronosPrim TimeDefined in chronos-1.1.6.1 · ChronosFromJSON TimeDefined in chronos-1.1.6.1 · ChronosToJSON TimeDefined in chronos-1.1.6.1 · ChronosTorsor Time TimespanDefined in chronos-1.1.6.1 · Chronos
Match a DayOfWeek. By match, we mean that a DayOfWeekMatch
is a mapping from the integer value of a DayOfWeek to some value
of type a. You should construct a DayOfWeekMatch with
buildDayOfWeekMatch, and match it using caseDayOfWeek.
Constructors
Instances1NFData
NFData a => NFData (DayOfWeekMatch a)Defined in chronos-1.1.6.1 · Chronos
Match a Month. By match, we mean that a MonthMatch is
a mapping from the integer value of a Month to some value of
type a. You should construct a MonthMatch with
buildMonthMatch, and match it using caseMonth.
Constructors
Instances1NFData
NFData a => NFData (MonthMatch a)Defined in chronos-1.1.6.1 · Chronos
Like MonthMatch, but the matched value can have an instance of Unbox.
Constructors
Instances1NFData
NFData (UnboxedMonthMatch a)Defined in chronos-1.1.6.1 · Chronos
A timespan. This is represented internally as a number of nanoseconds.
Constructors
Instances12Eq, Ord, Read, Show, Semigroup, Monoid, …
Eq TimespanDefined in chronos-1.1.6.1 · ChronosOrd TimespanDefined in chronos-1.1.6.1 · ChronosRead TimespanDefined in chronos-1.1.6.1 · ChronosShow TimespanDefined in chronos-1.1.6.1 · ChronosSemigroup TimespanDefined in chronos-1.1.6.1 · ChronosMonoid TimespanDefined in chronos-1.1.6.1 · ChronosNFData TimespanDefined in chronos-1.1.6.1 · ChronosFromJSON TimespanDefined in chronos-1.1.6.1 · ChronosToJSON TimespanDefined in chronos-1.1.6.1 · ChronosAdditive TimespanDefined in chronos-1.1.6.1 · ChronosScaling Timespan Int64Defined in chronos-1.1.6.1 · ChronosTorsor Time TimespanDefined in chronos-1.1.6.1 · Chronos
The precision used when encoding seconds to a human-readable format.
Constructors
SubsecondPrecisionAutoRounds to second, millisecond, microsecond, or nanosecond
SubsecondPrecisionFixed !IntSpecify number of places after decimal
Instances5Eq, Ord, Read, Show, NFData
Eq SubsecondPrecisionDefined in chronos-1.1.6.1 · ChronosOrd SubsecondPrecisionDefined in chronos-1.1.6.1 · ChronosRead SubsecondPrecisionDefined in chronos-1.1.6.1 · ChronosShow SubsecondPrecisionDefined in chronos-1.1.6.1 · ChronosNFData SubsecondPrecisionDefined in chronos-1.1.6.1 · Chronos
A date as represented by the Gregorian calendar.
Instances7Enum, Eq, Ord, Read, Show, NFData, …
Enum DateDefined in chronos-1.1.6.1 · ChronosEq DateDefined in chronos-1.1.6.1 · ChronosOrd DateDefined in chronos-1.1.6.1 · ChronosRead DateDefined in chronos-1.1.6.1 · ChronosShow DateDefined in chronos-1.1.6.1 · ChronosNFData DateDefined in chronos-1.1.6.1 · ChronosTorsor Date IntDefined in chronos-1.1.6.1 · Chronos
An OrdinalDate is a Year and the number of days elapsed since the Year began.
Constructors
Instances7Enum, Eq, Ord, Read, Show, NFData, …
Enum OrdinalDateDefined in chronos-1.1.6.1 · ChronosEq OrdinalDateDefined in chronos-1.1.6.1 · ChronosOrd OrdinalDateDefined in chronos-1.1.6.1 · ChronosRead OrdinalDateDefined in chronos-1.1.6.1 · ChronosShow OrdinalDateDefined in chronos-1.1.6.1 · ChronosNFData OrdinalDateDefined in chronos-1.1.6.1 · ChronosTorsor OrdinalDate IntDefined in chronos-1.1.6.1 · Chronos
A month and the day of the month. This does not actually represent a specific date, since this recurs every year.
Constructors
A Date as represented by the Gregorian calendar and a TimeOfDay. While the ToJSON instance encodes with a hyphen separator, the FromJSON instance allows any non-digit character to act as separator, using the lenient parser.
Constructors
Instances7Eq, Ord, Read, Show, NFData, FromJSON, …
Eq DatetimeDefined in chronos-1.1.6.1 · ChronosOrd DatetimeDefined in chronos-1.1.6.1 · ChronosRead DatetimeDefined in chronos-1.1.6.1 · ChronosShow DatetimeDefined in chronos-1.1.6.1 · ChronosNFData DatetimeDefined in chronos-1.1.6.1 · ChronosFromJSON DatetimeDefined in chronos-1.1.6.1 · ChronosToJSON DatetimeDefined in chronos-1.1.6.1 · Chronos
Constructors
Instances5Eq, Ord, Read, Show, NFData
Eq OffsetDatetimeDefined in chronos-1.1.6.1 · ChronosOrd OffsetDatetimeDefined in chronos-1.1.6.1 · ChronosRead OffsetDatetimeDefined in chronos-1.1.6.1 · ChronosShow OffsetDatetimeDefined in chronos-1.1.6.1 · ChronosNFData OffsetDatetimeDefined in chronos-1.1.6.1 · Chronos
A time of day with nanosecond resolution.
Constructors
The format of a Datetime. In particular this provides separators for parts of the Datetime and nothing else.
Constructors
DatetimeFormatdatetimeFormatDateSeparator :: !Maybe CharSeparator in the date
datetimeFormatSeparator :: !Maybe CharSeparator between date and time
datetimeFormatTimeSeparator :: !Maybe CharSeparator in the time
Instances5Eq, Ord, Read, Show, NFData
Eq DatetimeFormatDefined in chronos-1.1.6.1 · ChronosOrd DatetimeFormatDefined in chronos-1.1.6.1 · ChronosRead DatetimeFormatDefined in chronos-1.1.6.1 · ChronosShow DatetimeFormatDefined in chronos-1.1.6.1 · ChronosNFData DatetimeFormatDefined in chronos-1.1.6.1 · Chronos
Formatting settings for a timezone offset.
Constructors
OffsetFormatColonOff%z(e.g., -0400)OffsetFormatColonOn%:z(e.g., -04:00)OffsetFormatSecondsPrecision%::z(e.g., -04:00:00)OffsetFormatColonAuto%:::z(e.g., -04, +05:30)
Instances9Bounded, Enum, Eq, Ord, Read, Show, …
Bounded OffsetFormatDefined in chronos-1.1.6.1 · ChronosEnum OffsetFormatDefined in chronos-1.1.6.1 · ChronosEq OffsetFormatDefined in chronos-1.1.6.1 · ChronosOrd OffsetFormatDefined in chronos-1.1.6.1 · ChronosRead OffsetFormatDefined in chronos-1.1.6.1 · ChronosShow OffsetFormatDefined in chronos-1.1.6.1 · ChronosGeneric OffsetFormatDefined in chronos-1.1.6.1 · ChronosNFData OffsetFormatDefined in chronos-1.1.6.1 · Chronostype Rep OffsetFormat = D1 ('MetaDataDefined in chronos-1.1.6.1 · Chronos"OffsetFormat"
"Chronos"
"chronos-1.1.6.1-3ecXKVdGb3TC1anzF8yOq7"
'False) ((C1 ('MetaCons"OffsetFormatColonOff"
'PrefixI 'False) U1 :+: C1 ('MetaCons"OffsetFormatColonOn"
'PrefixI 'False) U1) :+: (C1 ('MetaCons"OffsetFormatSecondsPrecision"
'PrefixI 'False) U1 :+: C1 ('MetaCons"OffsetFormatColonAuto"
'PrefixI 'False) U1))
Locale-specific formatting for weekdays and months. The
type variable will likely be instantiated to Text
or ByteString.
Constructors
DatetimeLocaledatetimeLocaleDaysOfWeekFull :: !DayOfWeekMatch afull weekdays starting with Sunday, 7 elements
datetimeLocaleDaysOfWeekAbbreviated :: !DayOfWeekMatch aabbreviated weekdays starting with Sunday, 7 elements
datetimeLocaleMonthsFull :: !MonthMatch afull months starting with January, 12 elements
datetimeLocaleMonthsAbbreviated :: !MonthMatch aabbreviated months starting with January, 12 elements
Instances1NFData
NFData a => NFData (DatetimeLocale a)Defined in chronos-1.1.6.1 · Chronos
Locale-specific formatting for AM and PM.
Constructors
MeridiemLocalemeridiemLocaleAm :: !ameridiemLocalePm :: !a
Instances5Eq, Ord, Read, Show, NFData
Eq a => Eq (MeridiemLocale a)Defined in chronos-1.1.6.1 · ChronosOrd a => Ord (MeridiemLocale a)Defined in chronos-1.1.6.1 · ChronosRead a => Read (MeridiemLocale a)Defined in chronos-1.1.6.1 · ChronosShow a => Show (MeridiemLocale a)Defined in chronos-1.1.6.1 · ChronosNFData a => NFData (MeridiemLocale a)Defined in chronos-1.1.6.1 · Chronos
A TimeInterval represents a start and end time. It can sometimes be more ergonomic than the Torsor API when you only care about whether or not a Time is within a certain range.
To construct a TimeInterval, it is best to use timeIntervalBuilder,
which maintains the invariant that lowerBound interval <= upperBound interval
(all functions that act on TimeIntervals assume this invariant).
Constructors
Instances6Bounded, Eq, Ord, Read, Show, NFData
Bounded TimeIntervalDefined in chronos-1.1.6.1 · ChronosEq TimeIntervalDefined in chronos-1.1.6.1 · ChronosOrd TimeIntervalDefined in chronos-1.1.6.1 · ChronosRead TimeIntervalDefined in chronos-1.1.6.1 · ChronosShow TimeIntervalDefined in chronos-1.1.6.1 · ChronosNFData TimeIntervalDefined in chronos-1.1.6.1 · Chronos
Holds all of the parts encoded by a Time. Can be used for formatting if what is presently in the API does not suffice.
Constructors
TimePartstimePartsDay :: !Intdays 0-31
timePartsMonth :: !Intmonths 0-11
timePartsYear :: !InttimePartsHour :: !Inthours 0-23
timePartsMinute :: !Intminutes 0-59
timePartsSecond :: !Intseconds 0-59
timePartsSubsecond :: !Intfraction of a second with nanosecond resolution
timePartsOffset :: !Int
Lenses
26 declarationsA lens-compatible variant of half of the timeToDatetime/datetimeToTime isomorphism.
Note: We do not provide an iso as that requires a dependence on the profunctor
package.
A lens-compatible variant of half of the timeToDatetime/datetimeToTime isomorphism.
Note: We do not provide an iso as that requires a dependence on the profunctor
package.
a lens for accessing the getDay field.
a lens for accessing the getDayOfWeek field.
a lens for accessing the getDayOfMonth field.
a lens for accessing the getDayOfYear field.
a lens for accessing the getMonth field.
a lens for accessing the getOffset field.
a lens for accessing the getTime field.
a lens for accessing the getTimespan field.
a lens for accessing the dateYear field.
a lens for accessing the dateMonth field.
a lens for accessing the dateDay field.
a lens for accessing the ordinalDateYear field.
a lens for accessing the ordinalDateDayOfYear field.
a lens for accessing the monthDateMonth field.
a lens for accessing the monthDateDay field.
a lens for accessing the datetimeDate field.
a lens for accessing the datetimeTime field.
a lens for accessing the offsetDatetimeDatetime field.
a lens for accessing the offsetDatetimeOffset field.
a lens for accessing the timeOfDayHour field.
a lens for accessing the timeOfDayMinute field.
a lens for accessing the timeOfDayNanoseconds field.