local: check offset sanity before accumulation

Don't accept an offset that points to time before 1970 or outside the
interval to which is mapped NTP time.
This commit is contained in:
Miroslav Lichvar
2015-04-07 14:58:58 +02:00
parent 183a648d01
commit aec97397e8
8 changed files with 77 additions and 13 deletions

3
util.h
View File

@@ -104,6 +104,9 @@ extern void UTI_TimevalToInt64(struct timeval *src, NTP_int64 *dest, uint32_t fu
extern void UTI_Int64ToTimeval(NTP_int64 *src, struct timeval *dest);
/* Check if time + offset is sane */
extern int UTI_IsTimeOffsetSane(struct timeval *tv, double offset);
extern void UTI_TimevalNetworkToHost(Timeval *src, struct timeval *dest);
extern void UTI_TimevalHostToNetwork(struct timeval *src, Timeval *dest);