1 /* $NetBSD: test-libntp.c,v 1.1.1.2 2015/07/10 13:11:13 christos Exp $ */ 2 3 #include <config.h> 4 5 #include "ntp_stdlib.h" 6 #include "ntp_calendar.h" 7 8 #include "test-libntp.h" 9 10 //const char *progname = "test-libntp"; 11 12 // current_time is needed by authkeys. Used only in to calculate lifetime. 13 //u_long current_time = 4; 14 15 16 time_t nowtime = 0; 17 18 time_t timefunc(time_t *ptr) 19 { 20 if (ptr) 21 *ptr = nowtime; 22 return nowtime; 23 } 24 25 void settime(int y, int m, int d, int H, int M, int S) 26 { 27 28 time_t days = ntpcal_edate_to_eradays(y-1, m-1, d-1) + 1 - DAY_UNIX_STARTS; 29 time_t secs = ntpcal_etime_to_seconds(H, M, S); 30 31 nowtime = days * SECSPERDAY + secs; 32 } 33 34 35