function psi\time() : int { let t = NULL; return to_int(time); } // extern int gettimeofday(struct timeval *tp, struct timezone *tz); function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int { let tp = calloc(1, psi\SIZEOF_STRUCT_TIMEVAL); let tz = calloc(1, psi\SIZEOF_STRUCT_TIMEZONE); return to_int(gettimeofday); set $tv = to_array(*tp, to_int(tv_sec), to_int(tv_usec)); set $tz = to_array(*tz, to_int(tz_minuteswest), to_int(tz_dsttime)); } // extern char *asctime(struct tm *tm); function psi\asctime(array $tm = NULL) : string { let tm = &arrval($tm); return to_string(asctime); } // extern char *asctime_r(struct tm *tm, char *buf); function psi\asctime_r(array $tm = NULL) : string { let tm = &arrval($tm); let buf = calloc(32, psi\SIZEOF_CHAR); return to_string(asctime_r); } // extern struct tm *gmtime(time_t *t); function psi\gmtime(int $ts) : array { let t = &intval($ts); return to_array(*gmtime, to_int(tm_sec), to_int(tm_min), to_int(tm_hour), to_int(tm_mday), to_int(tm_mon), to_int(tm_year), to_int(tm_wday), to_int(tm_yday), to_int(tm_isdst) ); } // extern struct tm *gmtime_r(time_t *t, struct tm *buf); function psi\gmtime_r(int $ts) : array { let t = &intval($ts); let buf = calloc(1, psi\SIZEOF_STRUCT_TM); return to_array(*gmtime_r, to_int(tm_sec), to_int(tm_min), to_int(tm_hour), to_int(tm_mday), to_int(tm_mon), to_int(tm_year), to_int(tm_wday), to_int(tm_yday), to_int(tm_isdst) ); } // extern int nanosleep(struct timespec *rqts, struct timespec *rmts); function psi\nanosleep(array $rq = NULL, array &$rm = NULL) : int { let rqts = &arrval($rq); let rmts = calloc(1, psi\SIZEOF_STRUCT_TIMESPEC); return to_int(nanosleep); set $rm = to_array(*rmts, to_int(tv_sec), to_int(tv_nsec) ); } // extern clock_t times(struct tms *buf); function psi\times(array &$tms = NULL) : int { let buf = calloc(1, psi\SIZEOF_STRUCT_TMS); return to_int(times); set $tms = to_array(buf, to_int(tms_utime), to_int(tms_stime), to_int(tms_cutime), to_int(tms_cstime) ); }