1 /* $NetBSD: test-libntp.c,v 1.2 2020/05/25 20:47:36 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 11 time_t nowtime = 0; 12 13 14 time_t 15 timefunc(time_t *ptr) { 16 if (ptr) 17 *ptr = nowtime; 18 return nowtime; 19 } 20 21 22 void 23 settime(int y, int m, int d, int H, int M, int S) { 24 25 time_t days = ntpcal_edate_to_eradays(y-1, m-1, d-1) + 1 - DAY_UNIX_STARTS; 26 time_t secs = ntpcal_etime_to_seconds(H, M, S); 27 28 nowtime = days * SECSPERDAY + secs; 29 } 30