Annotation of embedaddon/ntp/ports/winnt/libntp/SetSystemTime.c, revision 1.1.1.1
1.1 misho 1:
2: #include "clockstuff.h"
3: #include "ntp_stdlib.h"
4:
5: pset_tod_using set_tod_using = NULL;
6:
7: time_stepped_callback step_callback = NULL;
8:
9: int
10: ntp_set_tod(
11: struct timeval *tv,
12: void *tzp
13: )
14: {
15: SYSTEMTIME st;
16: union {
17: FILETIME ft;
18: ULONGLONG ull;
19: } t;
20:
21: UNUSED_ARG(tzp);
22:
23: t.ull = FILETIME_1970 +
24: (ULONGLONG)tv->tv_sec * 10 * 1000 * 1000 +
25: (ULONGLONG)tv->tv_usec * 10;
26:
27: if (!FileTimeToSystemTime(&t.ft, &st) || !SetSystemTime(&st)) {
28: msyslog(LOG_ERR, "SetSystemTime failed: %m\n");
29: return -1;
30: }
31:
32: if (step_callback)
33: (*step_callback)();
34:
35: return 0;
36: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>