libraryextensions/clock/lib/Clock.xtl

Clock.xtl -- the facade of the clock extension: wall-clock and monotonic time, which X_eTaL does not have, for timestamps and timing. Import: "ck:" u_se< "Clock" Run with xetal-x (xetal-x --ext DIR puts this directory on XETAL_PATH). Each signature line is written out by the binding macro (lib/Ffi.xtlm).

source · imports ffi: lib/Ffi.xtlm

ˡn̲ow : Unit -> Float

function · line 10

Seconds since 1970-01-01 UTC, with the fraction.

"n_ow : unit -> float"          ᶠᶠⁱb̲ind< "clock/now"
ᶠᶠⁱb̲ind< expands to
ˡn̲ow ← { @ →
  f̲irst n̲umbers ⎕N̲GET "ext:clock/now"
}

ˡi̲so : Unit -> Char

function · line 12

The current time as ISO 8601 UTC text, to the millisecond.

"i_so : unit -> text"           ᶠᶠⁱb̲ind< "clock/iso"
ᶠᶠⁱb̲ind< expands to
ˡi̲so ← { @ →
  ⎕N̲GET "ext:clock/iso"
}

ˡi̲soOf : Num a => a -> Char

function · line 14

Unix seconds as ISO 8601 UTC text: ck:i_soOf 0 is 1970-01-01T00:00:00.000Z.

"i_soOf : float -> text"        ᶠᶠⁱb̲ind< "clock/iso_of"
ᶠᶠⁱb̲ind< expands to
ˡi̲soOf ← { a →
  pa ← (f̲ormat r̲avel f̲loat a) ⎕N̲PUT "ext:clock/iso_of?float=" c̲at f̲ormat s̲hape a
  ⎕N̲GET "ext:clock/iso_of"
}

ˡm̲illis : Unit -> Float

function · line 16

Milliseconds on a monotonic clock (it never goes back).

"m_illis : unit -> float"       ᶠᶠⁱb̲ind< "clock/millis"
ᶠᶠⁱb̲ind< expands to
ˡm̲illis ← { @ →
  f̲irst n̲umbers ⎕N̲GET "ext:clock/millis"
}
Used in: ˡt̲ime

ˡt̲ime : (Any a, Any b) => (a -> b) -> a -> Float

function · line 20

How many milliseconds f_ x takes: 'r_ange ck:t_ime 1000000 (written in X_eTaL over m_illis).

ˡt̲ime ← { f̲ x →
  a ← ˡm̲illis @
  r ← f̲ x
  (ˡm̲illis @) − a
}

ˡpackage : Char

value · line 27

The native package behind these functions.

ˡpackage ← "clock"