Fuzz transmit timestamp

Add random bits below clock precision to the timestamp to make
it less predictable.
This commit is contained in:
Miroslav Lichvar
2012-05-22 17:16:41 +02:00
parent d0acfc2652
commit df6c2a432f
6 changed files with 41 additions and 13 deletions

4
util.h
View File

@@ -88,8 +88,10 @@ extern char *UTI_TimeToLogForm(time_t t);
/* Adjust time following a frequency/offset change */
extern void UTI_AdjustTimeval(struct timeval *old_tv, struct timeval *when, struct timeval *new_tv, double *delta, double dfreq, double doffset);
/* Get a random value to fuzz an NTP timestamp in the given precision */
extern uint32_t UTI_GetNTPTsFuzz(int precision);
extern void UTI_TimevalToInt64(struct timeval *src, NTP_int64 *dest);
extern void UTI_TimevalToInt64(struct timeval *src, NTP_int64 *dest, uint32_t fuzz);
extern void UTI_Int64ToTimeval(NTP_int64 *src, struct timeval *dest);