--- ./plugins/check_ntp_time.c.orig 2026-09-08 04:00:22.653798878 -0400 +++ ./plugins/check_ntp_time.c 2026-09-08 04:04:22.451464206 -0400 @@ -177,8 +177,13 @@ double ntp32_to_double(uint32_t n) { double result = 0; if (n) { + #ifdef WORDS_BIGENDIAN + uint16_t l16 = ntohs((uint16_t) (n >> 16)); + uint16_t r16 = ntohs((uint16_t) (n & ((1<<16) - 1))); + #else uint16_t l16 = ntohs((uint16_t) (n & ((1<<16) - 1))); uint16_t r16 = ntohs((uint16_t) (n >> 16)); + #endif result = l16 + ((double) r16/65536.0); } return result; @@ -190,8 +195,13 @@ double ntp64_to_double(uint64_t n) { double result = 0; if (n) { + #ifdef WORDS_BIGENDIAN + uint32_t l32 = ntohl((uint32_t) (n >> 32)); + uint32_t r32 = ntohl((uint32_t) (n & ((1ul<<32) - 1))); + #else uint32_t l32 = ntohl((uint32_t) (n & ((1ul<<32) - 1))); uint32_t r32 = ntohl((uint32_t) (n >> 32)); + #endif result = (l32 - EPOCHDIFF) + (.00000001*(0.5+(double)(r32/42.94967296))); } @@ -210,8 +220,13 @@ struct timeval ntp64_to_tv(uint64_t n) { struct timeval result = {}; if (n) { + #ifdef WORDS_BIGENDIAN + uint32_t l32 = ntohl((uint32_t) (n >> 32)); + uint32_t r32 = ntohl((uint32_t) (n & ((1ul<<32) - 1))); + #else uint32_t l32 = ntohl((uint32_t) (n & ((1ul<<32) - 1))); uint32_t r32 = ntohl((uint32_t) (n >> 32)); + #endif result.tv_sec = l32 - EPOCHDIFF; result.tv_usec = (int)(0.5+(double)(r32/4294.967296)); }