Skip to content

Commit f1877cb

Browse files
committed
ipfix-elements: fix NTP_USEC_TO_FRAC macro
Use standard conversion to ntp timestamps as in https://tickelton.gitlab.io/articles/ntp-timestamps/.
1 parent 6532d55 commit f1877cb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

include/ipfixprobe/ipfix-elements.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ namespace ipxp {
5151

5252
/**
5353
* Conversion from microseconds to NTP fraction (resolution 1/(2^32)s, ~233 picoseconds).
54-
* Division by 1000000 would lead to wrong value when converting fraction back to microseconds, so 999999 is used.
5554
*/
56-
#define NTP_USEC_TO_FRAC(usec) (uint32_t)(((uint64_t) usec << 32) / 999999)
55+
#define NTP_USEC_TO_FRAC(usec) (uint32_t)(((uint64_t) usec << 32) / 1000000)
5756

5857
/**
5958
* Create 64 bit NTP timestamp which consist of 32 bit seconds part and 32 bit fraction part.

0 commit comments

Comments
 (0)