APITime.Internal

Time.Internal

Raw value representations and shared text machinery for the Time modules. The constructors here bypass validation: application code must use the checked constructors of Time.Date, Time.TimeOfDay, and Time.Instant, which re-export these types without their constructors.

Date

type Date = Date IntSource

A calendar date. Equality and ordering compare calendar positions.

Constructors

Date

Date : Int -> DateSource

The day serial, where 0001-01-01 is 0 and 9999-12-31 is 3652058.

Instances:

Eq Date
Ord Date
Show Date

Instant

type Instant = Instant Int IntSource

A moment on the Unix time line. Ordering compares the moment.

Constructors

Instant

Instant : Int -> Int -> InstantSource

Unix floor seconds within instantMin through instantMax, and the nanosecond fraction, 0 through 999999999.

Instances:

Eq Instant
Ord Instant
Show Instant

TimeOfDay

type TimeOfDay = TimeOfDay IntSource

A clock reading. Ordering runs from midnight to the final nanosecond.

Constructors

TimeOfDay

TimeOfDay : Int -> TimeOfDaySource

Nanoseconds since midnight, below 86400000000000.

Instances:

Eq TimeOfDay
Ord TimeOfDay
Show TimeOfDay

digits

digits : Int -> Int -> String ->{Fail Error} IntSource

Parses exactly the requested ASCII decimal slice, rejecting short input.

floorDiv

floorDiv : Int -> Int -> IntSource

Floor division by a positive divisor.

format

format : (String -> Maybe String) -> String -> StringSource

Expands percent tokens through a type-specific renderer. %% is a percent sign; a token the renderer does not know, or a trailing %, is copied verbatim so a typo stays visible in the output rather than failing.

fraction

fraction : Int -> StringSource

Canonical optional fractional seconds, omitting zero and trailing zeros.

instantMax

instantMax : IntSource

The latest supported Unix second, 9999-12-30T23:59:59Z.

instantMin

instantMin : IntSource

The earliest supported Unix second, 0001-01-02T00:00:00Z. The margin of one day keeps every local date within year 1 for any offset below 24 hours.

offsetText

offsetText : Bool -> Int -> StringSource

Formats a bounded zone offset, including seconds when nonzero.

pad

pad : Int -> Int -> StringSource

Zero-pads a nonnegative decimal field to at least the given width.

require

require : Error -> Bool ->{Fail Error} ()Source

Fails with the supplied error unless the condition holds.