1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/timex: change type of NS_PER_SEC

Having NS_PER_SEC defined as `1000000000U` is quite a foot gun, as
multiplication even with small numbers in 32 bit quickly overflows. Using the
`1000000000LLU` instead forces 64 bit math.
This commit is contained in:
Marian Buschsieweke 2020-12-02 17:49:58 +01:00
parent 3234b918e3
commit d59607ddb7
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F

View File

@ -66,7 +66,7 @@ extern "C" {
/**
* @brief The number of nanoseconds per second
*/
#define NS_PER_SEC (1000000000U)
#define NS_PER_SEC (1000000000LLU)
/**
* @brief The maximum length of the string representation of a timex timestamp