flush
[m6w6/ext-psi] / psi.d / time.psi
index ae16b0a71d0d7544daed3de3818b25dadbfe3431..9302b136f5fcbb8b4f8aa910a359515fbc9dc1cf 100644 (file)
@@ -1,3 +1,4 @@
+// extern time_t time(time_t *t);
 function psi\time() : int {
        let t = NULL;
        return to_int(time);
@@ -18,13 +19,13 @@ function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int {
 
 // extern char *asctime(struct tm *tm);
 function psi\asctime(array $tm = NULL) : string {
-       let tm = arrval($tm);
+       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 tm = &arrval($tm);
        let buf = calloc(32, psi\SIZEOF_CHAR);
        return to_string(asctime_r);
 }
@@ -64,7 +65,7 @@ function psi\gmtime_r(int $ts) : array {
 
 // extern int nanosleep(struct timespec *rqts, struct timespec *rmts);
 function psi\nanosleep(array $rq = NULL, array &$rm = NULL) : int {
-       let rqts = arrval($rq);
+       let rqts = &arrval($rq);
        let rmts = calloc(1, psi\SIZEOF_STRUCT_TIMESPEC);
        return to_int(nanosleep);
        set $rm = to_array(*rmts,