flush
[m6w6/ext-psi] / tests / time / time.psi
1 extern int gettimeofday(struct timeval *tv, struct timezone *tz);
2 function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int {
3 let tv = calloc(1, struct timeval);
4 let tz = calloc(1, struct timezone);
5 return to_int(gettimeofday);
6 set $tv = to_array(*tv);
7 set $tz = to_array(*tz);
8 }
9
10 extern char *asctime(struct tm *tm);
11 function psi\asctime(array $tm = NULL) : string {
12 let tm = arrval($tm);
13 return to_string(asctime);
14 }
15
16
17 extern struct tm *gmtime(time_t tp);
18 function psi\gmtime(int $ts) : array {
19 let tp = &intval($ts);
20 return to_array(gmtime);
21 }
22
23 extern int nanosleep(struct timespec *rqtp, struct timespec *rmtp);
24 function psi\nanosleep(array $rq = NULL, array &$rm = NULL) : int {
25 let rqtp = arrval($rq);
26 let rmtp = calloc(1, struct timespec);
27 return to_int(nanosleep);
28 set $rm = to_array(*rmtp);
29 }