From: Tomasz Flendrich Date: Fri, 19 Jun 2015 18:00:35 +0000 (+0000) Subject: bring back two files that were wrongfully removed X-Git-Tag: NTP_4_3_43~2^2~24^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21a746ae448422ffae2d10d01272137ce7b5a992;p=thirdparty%2Fntp.git bring back two files that were wrongfully removed bk: 558458c3XwIkH_3CLrNwGZTrNXfP6g --- diff --git a/tests/libntp/test-libntp.c b/tests/libntp/test-libntp.c new file mode 100644 index 000000000..3e50e8e8f --- /dev/null +++ b/tests/libntp/test-libntp.c @@ -0,0 +1,31 @@ +#include + +#include "ntp_stdlib.h" +#include "ntp_calendar.h" +#include "test-libntp.h" + +//const char *progname = "test-libntp"; + +// current_time is needed by authkeys. Used only in to calculate lifetime. +//u_long current_time = 4; + + +time_t nowtime = 0; + +time_t timefunc(time_t *ptr) +{ + if (ptr) + *ptr = nowtime; + return nowtime; +} + +void settime(int y, int m, int d, int H, int M, int S) +{ + + time_t days = ntpcal_edate_to_eradays(y-1, m-1, d-1) + 1 - DAY_UNIX_STARTS; + time_t secs = ntpcal_etime_to_seconds(H, M, S); + + nowtime = days * SECSPERDAY + secs; +} + + diff --git a/tests/libntp/test-libntp.h b/tests/libntp/test-libntp.h new file mode 100644 index 000000000..eb113cd52 --- /dev/null +++ b/tests/libntp/test-libntp.h @@ -0,0 +1,3 @@ +time_t timefunc(time_t *ptr); +void settime(int y, int m, int d, int H, int M, int S); +time_t nowtime;