projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
configure: better support for extvars
[m6w6/ext-psi]
/
psi.d
/
time.psi
diff --git
a/psi.d/time.psi
b/psi.d/time.psi
index 1281c51d988867b3eb624fdb3266e83ce4ae2423..30f713b8bfef3aaf90e47a78760ae2b5e4c5f89e 100644
(file)
--- a/
psi.d/time.psi
+++ b/
psi.d/time.psi
@@
-1,38
+1,37
@@
-extern time_t time(time_t *t);
function psi\time() : int {
let t = NULL;
return to_int(time);
}
function psi\time() : int {
let t = NULL;
return to_int(time);
}
-
extern int gettimeofday(struct timeval *tv
, struct timezone *tz);
+
// extern int gettimeofday(struct timeval *tp
, struct timezone *tz);
function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int {
function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int {
- let t
v = calloc(1, struct timeval
);
- let tz = calloc(1,
struct timezone
);
+ let t
p = calloc(1, psi\SIZEOF_STRUCT_TIMEVAL
);
+ let tz = calloc(1,
psi\SIZEOF_STRUCT_TIMEZONE
);
return to_int(gettimeofday);
return to_int(gettimeofday);
- set $tv = to_array(*t
v,
- to_int(tv_sec),
+ set $tv = to_array(*t
p,
+ to_int(tv_sec),
to_int(tv_usec));
to_int(tv_usec));
- set $tz = to_array(*tz,
- to_int(tz_minuteswest),
+ set $tz = to_array(*tz,
+ to_int(tz_minuteswest),
to_int(tz_dsttime));
}
to_int(tz_dsttime));
}
-extern char *asctime(struct tm *tm);
+
//
extern char *asctime(struct tm *tm);
function psi\asctime(array $tm = NULL) : string {
function psi\asctime(array $tm = NULL) : string {
- let tm = arrval($tm);
+ let tm =
&
arrval($tm);
return to_string(asctime);
}
return to_string(asctime);
}
-extern char *asctime_r(struct tm *tm, char *buf);
+
//
extern char *asctime_r(struct tm *tm, char *buf);
function psi\asctime_r(array $tm = NULL) : string {
function psi\asctime_r(array $tm = NULL) : string {
- let tm = arrval($tm);
- let buf = calloc(32,
char
);
+ let tm =
&
arrval($tm);
+ let buf = calloc(32,
psi\SIZEOF_CHAR
);
return to_string(asctime_r);
}
return to_string(asctime_r);
}
-
extern struct tm *gmtime(time_t *tp
);
+
// extern struct tm *gmtime(time_t *t
);
function psi\gmtime(int $ts) : array {
function psi\gmtime(int $ts) : array {
- let t
p
= &intval($ts);
+ let t = &intval($ts);
return to_array(*gmtime,
to_int(tm_sec),
to_int(tm_min),
return to_array(*gmtime,
to_int(tm_sec),
to_int(tm_min),
@@
-46,10
+45,10
@@
function psi\gmtime(int $ts) : array {
);
}
);
}
-
extern struct tm *gmtime_r(time_t *tp
, struct tm *buf);
+
// extern struct tm *gmtime_r(time_t *t
, struct tm *buf);
function psi\gmtime_r(int $ts) : array {
function psi\gmtime_r(int $ts) : array {
- let t
p
= &intval($ts);
- let buf = calloc(1,
struct tm
);
+ 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),
return to_array(*gmtime_r,
to_int(tm_sec),
to_int(tm_min),
@@
-63,20
+62,20
@@
function psi\gmtime_r(int $ts) : array {
);
}
);
}
-
extern int nanosleep(struct timespec *rqtp, struct timespec *rmtp
);
+
// extern int nanosleep(struct timespec *rqts, struct timespec *rmts
);
function psi\nanosleep(array $rq = NULL, array &$rm = NULL) : int {
function psi\nanosleep(array $rq = NULL, array &$rm = NULL) : int {
- let rqt
p =
arrval($rq);
- let rmt
p = calloc(1, struct timespec
);
+ let rqt
s = &
arrval($rq);
+ let rmt
s = calloc(1, psi\SIZEOF_STRUCT_TIMESPEC
);
return to_int(nanosleep);
return to_int(nanosleep);
- set $rm = to_array(*rmt
p
,
+ set $rm = to_array(*rmt
s
,
to_int(tv_sec),
to_int(tv_nsec)
);
}
to_int(tv_sec),
to_int(tv_nsec)
);
}
-extern clock_t times(struct tms *buf);
+
//
extern clock_t times(struct tms *buf);
function psi\times(array &$tms = NULL) : int {
function psi\times(array &$tms = NULL) : int {
- let buf = calloc(1,
struct tms
);
+ let buf = calloc(1,
psi\SIZEOF_STRUCT_TMS
);
return to_int(times);
set $tms = to_array(*buf,
to_int(tms_utime),
return to_int(times);
set $tms = to_array(*buf,
to_int(tms_utime),