Skip to content

On 32-bit systems, number of seconds in a GPS epoch may overflow

Sanjeev Gupta requested to merge ghane/ntpsec:DOUBLE into master

On a gcc 8.3 on a 32-bit system,

Size of int: 4 bytes
Size of long int: 4 bytes
Size of long long int: 8 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Size of long double: 12 bytes
Size of char: 1 byte

Explicitly cast to (long double) to prevent overflow of the seconds in a 13-bit week number

Edited by Sanjeev Gupta

Merge request reports