%{#
#include "libc/CATS/time.cats"
%}
abst@ype time_t = $extype "ats_time_type"
fun lint_of_time_t
(t: time_t):<> int_long_t0ype = "atslib_lint_of_time_t"
overload lint_of with lint_of_time_t
fun double_of_time_t
(t: time_t):<> double_t0ype = "atslib_double_of_time_t"
overload double_of with double_of_time_t
abst@ype tm_struct = $extype "ats_tm_struct_type"
fun tm_get_sec
(tm: &tm_struct): int = "atslib_tm_get_sec"
fun tm_get_min
(tm: &tm_struct): int = "atslib_tm_get_min"
fun tm_get_hour
(tm: &tm_struct): int = "atslib_tm_get_hour"
fun tm_get_mday
(tm: &tm_struct): int = "atslib_tm_get_mday"
fun tm_get_mon
(tm: &tm_struct): int = "atslib_tm_get_mon"
fun tm_get_year
(tm: &tm_struct): int = "atslib_tm_get_year"
fun tm_get_wday
(tm: &tm_struct): int = "atslib_tm_get_wday"
fun tm_get_yday
(tm: &tm_struct): int = "atslib_tm_get_yday"
fun tm_get_isdst
(tm: &tm_struct): int = "atslib_tm_get_isdst"
symintr time
fun time_get (): time_t = "atslib_time_get"
fun time_get_and_set {l:addr}
(pf: !time_t? @ l >> time_t @ l | p: ptr l): time_t
= "atslib_time_get_and_set"
fun difftime (finish: time_t, start: time_t):<> double
= "atslib_difftime"
fun localtime (time: &time_t):<!ref> [l:addr] (
option_v ((tm_struct @ l, tm_struct @ l -<prf> void), l>null) | ptr l
) = "#atslib_localtime"
abst@ype clock_t = $extype "ats_clock_type"
macdef CLOCKS_PER_SEC = $extval (clock_t, "CLOCKS_PER_SEC")
fun lint_of_clock_t
(c: clock_t):<> int_long_t0ype = "atslib_lint_of_clock_t"
overload lint_of with lint_of_clock_t
fun double_of_clock_t
(c: clock_t):<> double_t0ype = "atslib_double_of_clock_t"
overload double_of with double_of_clock_t
fun clock (): clock_t = "atslib_clock"