Integers and Floats categories
Primitives
Dates and Times
Chars

Dates and Times [XL]

Dates and times are represented using floats containing an UNIX C time that is the time in seconds since the Epoch (00:00:00 UTC, January 1, 1970). The use of float is required since CLAIRE integer are coded on 30 bits and times on 32 bits.

Internally, CLAIRE always handles dates represented in UTC. Times are referenced on the Epoch such the arithmetic between date and time can be made with the standard float arithmetic.

Two kind of timer are also supported, one that account time in the process time (time_set/time_get) and one that count in real time (timer!/elapsed).


categories Dates and Timesnormal dispatch [XL] Kernel method

date_add(d:float, c:char, i:integer) -> float

date_add(d, c, i) returns the date d incremented by i, where the unit of the increment depends on c :


categories Dates and Timesnormal dispatch [XL] Kernel method

diff_time(d1:float, d2:float) -> float

diff_time(d1, d2) returns the difference d1 - d2 in seconds.


categories Dates and Timesnormal dispatch [XL] Kernel method

elapsed(t:float) -> integer

elapsed(t) returns the time in millisecond (accounted in real time) that has elapsed since the call to timer!()


categories Dates and Timesnormal dispatch [XL] Kernel method

explode(t:float) -> tuple(integer, 1 .. 12, 1 .. 365, 1 .. 31, 1 .. 7, 0 .. 23, 0 .. 59, 0 .. 59, boolean)

explode(t) explodes the calendar time t in integers. The returned value is a tuple made of :


categories Dates and Timesnormal dispatch [XL] Kernel method

make_date(s:string) -> float

make_date(s) parses the string s and tries to create a date with it according to RFC 1123


categories Dates and Timesnormal dispatch [XL] Kernel method

make_date(D:integer, M:integer, Y:integer, h:integer, m:integer, s:integer) -> float

make_date(D,M,Y,h,m,s) returns the date D/M/Y h:m:s where months are one based index (M = 1 is January).


categories Dates and Timesnormal dispatch [XL] Kernel method

make_time(s:string) -> float

make_time(s) parses the string s and tries to create a time with it


categories Dates and Timesnormal dispatch [XL] Kernel method

make_time(h:integer, m:integer, s:integer) -> float

returns the time constructed with the given hours, minutes and seconds


categories Dates and Timesnormal dispatch [XL] Kernel method

strftime(f:string, d:float) -> string

strftime(f,d) is a wrapper for the C lib strftime. f may contain formatters introduced by the '%' (see man).


categories Dates and Timesnormal dispatch Core method

time_get() -> integer

time_get() stops a clock started by time_set() it and returns the elapsed time in milliseconds.


categories Dates and Timesnormal dispatch Core method

time_set() -> void

time_set() starts a clock that will have to be stopped with time_get().


categories Dates and Timesnormal dispatch Core method

time_show() -> void

time_show pretty prints the current value of a timer started by time_set().


categories Dates and Timesnormal dispatch [XL] Kernel method

timer!() -> float

timer!() return the current date time in second with millisecond granularity. That is a real time clock is started, the returned value may be used with elapsed or uptime to get the time elapsed since the timer! call.


categories Dates and Timesnormal dispatch [XL] Kernel method

uptime(t:float) -> void

uptime(x) prints on the current output a human readable version of the time elapsed (accounted in real time) since timer! with millisecond granularity.