etc/services - sync with NetBSD-8
[minix.git] / minix / lib / libc / sys / clock_settime.c
blob6e4d1fc002031d2ab744279db1d3bfe99c5e0a34
1 #include <sys/cdefs.h>
2 #include <lib.h>
3 #include "namespace.h"
5 #include <string.h>
6 #include <time.h>
8 #ifdef __weak_alias
9 __weak_alias(clock_settime, __clock_settime50);
10 #endif
12 int clock_settime(clockid_t clock_id, const struct timespec *ts)
14 message m;
16 memset(&m, 0, sizeof(m));
17 m.m_lc_pm_time.clk_id = clock_id;
18 m.m_lc_pm_time.now = 1; /* set time immediately. don't use adjtime() method. */
19 m.m_lc_pm_time.sec = ts->tv_sec;
20 m.m_lc_pm_time.nsec = ts->tv_nsec;
22 if (_syscall(PM_PROC_NR, PM_CLOCK_SETTIME, &m) < 0)
23 return -1;
25 return 0;