POSIX-RT-Timer
view release on metacpan or search on metacpan
lib/POSIX/RT/Timer.xs view on Meta::CPAN
UV handle(POSIX::RT::Timer timer)
CODE:
RETVAL = (UV)timer;
OUTPUT:
RETVAL
void get_timeout(POSIX::RT::Timer timer)
PREINIT:
struct itimerspec value;
PPCODE:
if (timer_gettime(timer, &value) == -1)
die_sys("Couldn't get_time: %s");
mXPUSHs(timespec_to_sv(value.it_value));
if (GIMME_V == G_LIST)
mXPUSHs(timespec_to_sv(value.it_interval));
void set_timeout(POSIX::RT::Timer timer, struct timespec new_value, struct timespec new_interval = no_time, bool abstime = FALSE)
PREINIT:
struct itimerspec old_itimer;
PPCODE:
struct itimerspec new_itimer = { new_value, new_interval };
if (timer_settime(timer, (abstime ? TIMER_ABSTIME : 0), &new_itimer, &old_itimer) == -1)
die_sys("Couldn't set_time: %s");
mXPUSHs(timespec_to_sv(old_itimer.it_value));
if (GIMME_V == G_LIST)
mXPUSHs(timespec_to_sv(old_itimer.it_interval));
IV get_overrun(POSIX::RT::Timer timer)
CODE:
RETVAL = timer_getoverrun(timer);
lib/POSIX/RT/Timer.xs view on Meta::CPAN
}
OUTPUT:
RETVAL
#endif
void get_clocks(...)
PREINIT:
size_t i;
const size_t max = sizeof clocks / sizeof *clocks;
PPCODE:
for (i = 0; i < max; ++i)
mXPUSHp(clocks[i].key, clocks[i].key_length);
PUTBACK;
Time::Spec get_time(POSIX::RT::Clock clockid)
CODE:
RETVAL = safecalloc(1, sizeof(struct timespec));
if (clock_gettime(clockid, RETVAL) == -1) {
Safefree(RETVAL);
die_sys("Couldn't get time: %s");
( run in 0.791 second using v1.01-cache-2.11-cpan-4e7a2411597 )