blob: f3ba0bf98888e0d056080a637509532af218b0a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "syslib.h"
/*
* Ask the kernel to schedule a synchronous alarm for the caller, using either
* an absolute or a relative number of clock ticks. The new alarm replaces any
* previously set alarm. If a relative expiry time of zero is given, the
* current alarm is stopped. Return OK or a negative error code. On success,
* optionally return the time left on the previous timer (TMR_NEVER if none was
* set) and the current time.
*/
int
sys_setalarm2(clock_t exp_time, int abs_time, clock_t * time_left,
clock_t * uptime)
{
message m;
int r;
m.m_lsys_krn_sys_setalarm.exp_time = exp_time; /* expiration time */
m.m_lsys_krn_sys_setalarm.abs_time = abs_time; /* time is absolute? */
if ((r = _kernel_call(SYS_SETALARM, &m)) != OK)
return r;
if (time_left != NULL)
*time_left = m.m_lsys_krn_sys_setalarm.time_left;
if (uptime != NULL)
*uptime = m.m_lsys_krn_sys_setalarm.uptime;
return OK;
}
|