%{#
#include "libc/sys/CATS/time.cats"
%}
staload FCNTL = "libc/SATS/fcntl.sats"
viewdef fildes_v (fd: int) = $FCNTL.fildes_v (fd)
staload TYPES = "libc/sys/SATS/types.sats"
typedef time_t = $TYPES.time_t
typedef suseconds_t = $TYPES.suseconds_t
typedef timeval_struct =
$extype_struct "ats_timeval_type" of { tv_sec= time_t , tv_usec= suseconds_t } typedef timeval = timeval_struct
typedef timezone_struct =
$extype_struct "ats_timezone_type" of { tz_minuteswest= int , tz_dsttime= int } typedef timezone = timezone_struct
symintr gettimeofday
fun gettimeofday_tv
(tv: &timeval? >> opt (timeval, i==0))
:<> #[i:int | i <= 0] int i = "#atslib_gettimeofday_tv"
overload gettimeofday with gettimeofday_tv
fun gettimeofday_tz
(tz: &timezone? >> opt (timezone, i==0))
:<> #[i:int | i <= 0] int i = "#atslib_gettimeofday_tz"
overload gettimeofday with gettimeofday_tz
symintr settimeofday
fun settimeofday_tv
(tv: &timeval):<> [i:int | i <= 0] int i = "#atslib_settimeofday_tv"
overload settimeofday with settimeofday_tv
fun settimeofday_tz
(tz: &timezone):<> [i:int | i <= 0] int i = "#atslib_settimeofday_tz"
overload settimeofday with settimeofday_tz
fun settimeofday_tvtz
(tv: &timeval, tz: &timezone):<> [i:int | i <= 0] int i = "#atslib_settimeofday_tvtz"
overload settimeofday with settimeofday_tvtz
fun utimes (path: string, buf: &(@[timeval][2])): int = "#atslib_utimes"
fun futimes {fd:int} (pf: fildes_v fd | fd: int fd, buf: &(@[timeval][2])): int
= "#atslib_futimes"
fun futimesat (dirfd: int, path: string, buf: &(@[timeval][2])): int = "#atslib_futimesat"
abst@ype itimerknd_t = int
macdef ITIMER_REAL = $extval (itimerknd_t, "ITIMER_REAL")
macdef ITIMER_VIRTUAL = $extval (itimerknd_t, "ITIMER_VIRTUAL")
macdef ITIMER_PROF = $extval (itimerknd_t, "ITIMER_PROF")
typedef itimerval_struct =
$extype_struct "ats_itimerval_type" of {
it_interval= timeval, it_value= timeval
} typedef itimerval = itimerval_struct
fun getitimer (
which: itimerknd_t, itval: &itimerval? >> opt (itimerval, i==0)
) : #[i:int | i <= 0] int(i) = "#atslib_getitimer"
fun setitimer (
which: itimerknd_t
, itval: &itimerval, itval_old: &itimerval? >> opt (itimerval, i==0)
) : #[i:int | i <= 0] int(i) = "#atslib_setitimer"
fun setitimer_null
(which: itimerknd_t, itval: &itimerval): int = "#atslib_setitimer_null"