1 extern time_t time(time_t *t);
2 function psi\time() : int {
7 extern int gettimeofday(struct timeval *tv, struct timezone *tz);
8 function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int {
9 let tv = calloc(1, struct timeval);
10 let tz = calloc(1, struct timezone);
11 return to_int(gettimeofday);
12 set $tv = to_array(*tv,
15 set $tz = to_array(*tz,
16 to_int(tz_minuteswest),
20 extern char *asctime(struct tm *tm);
21 function psi\asctime(array $tm = NULL) : string {
23 return to_string(asctime);
26 extern char *asctime_r(struct tm *tm, char *buf);
27 function psi\asctime_r(array $tm = NULL) : string {
29 let buf = calloc(32, char);
30 return to_string(asctime_r);
33 extern struct tm *gmtime(time_t *tp);
34 function psi\gmtime(int $ts) : array {
35 let tp = &intval($ts);
36 return to_array(*gmtime,
49 extern struct tm *gmtime_r(time_t *tp, struct tm *buf);
50 function psi\gmtime_r(int $ts) : array {
51 let tp = &intval($ts);
52 let buf = calloc(1, struct tm);
53 return to_array(*gmtime_r,
66 extern int nanosleep(struct timespec *rqtp, struct timespec *rmtp);
67 function psi\nanosleep(array $rq = NULL, array &$rm = NULL) : int {
68 let rqtp = arrval($rq);
69 let rmtp = calloc(1, struct timespec);
70 return to_int(nanosleep);
71 set $rm = to_array(*rmtp,
77 extern clock_t times(struct tms *buf);
78 function psi\times(array &$tms = NULL) : int {
79 let buf = calloc(1, struct tms);
81 set $tms = to_array(*buf,