Skip to content

Commit

Permalink
Merge pull request #241 from CESNET/fix-ipfix-ntp-conversion
Browse files Browse the repository at this point in the history
ipfix-elements: fix NTP_USEC_TO_FRAC macro
  • Loading branch information
SiskaPavel authored Dec 9, 2024
2 parents 6532d55 + f1877cb commit 7ee2138
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions include/ipfixprobe/ipfix-elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ namespace ipxp {

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

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

0 comments on commit 7ee2138

Please sign in to comment.