Change the NS_PER_SEC (and friends) from enum to static const

New version of clang (19) has introduced a stricter checks when mixing
integer (and float types) with enums.  In this case, we used enum {}
as C17 doesn't have constexpr yet.  Change the time conversion constants
to be static const unsigned int instead of enum values.
This commit is contained in:
Ondřej Surý
2024-08-14 16:10:18 +02:00
parent 9c06717429
commit b03e90e0d4
5 changed files with 20 additions and 16 deletions

View File

@@ -203,8 +203,8 @@ void
dns_test_nap(uint32_t usec) {
struct timespec ts;
ts.tv_sec = usec / 1000000;
ts.tv_nsec = (usec % 1000000) * 1000;
ts.tv_sec = usec / (long)US_PER_SEC;
ts.tv_nsec = (usec % (long)US_PER_SEC) * (long)NS_PER_US;
nanosleep(&ts, NULL);
}