]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/tests/libntp/test-libntp.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / tests / libntp / test-libntp.c
1 #include <config.h>
2
3 #include "ntp_stdlib.h"
4 #include "ntp_calendar.h"
5
6 #include "test-libntp.h"
7
8 //const char *progname = "test-libntp";
9
10 // current_time is needed by authkeys. Used only in to calculate lifetime.
11 //u_long current_time = 4;
12
13
14 time_t nowtime = 0;
15
16 time_t timefunc(time_t *ptr)
17 {
18     if (ptr)
19         *ptr = nowtime;
20     return nowtime;
21 }
22
23 void settime(int y, int m, int d, int H, int M, int S)
24 {
25
26     time_t days = ntpcal_edate_to_eradays(y-1, m-1, d-1) + 1 - DAY_UNIX_STARTS;
27     time_t secs = ntpcal_etime_to_seconds(H, M, S);
28
29     nowtime = days * SECSPERDAY + secs;
30 }
31
32