summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2020-07-16 18:52:03 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2020-07-19 10:34:58 +0200
commitc90e48c005c59a95c1e58e95c1bd9fbcc70c3b06 (patch)
tree16ede768d47e5e2dd08e0dd580a5e9486c62ade9 /tests
parent2998749850f88d83d2ce291bc8f0a8b5e33e9599 (diff)
downloadcurl-c90e48c005c59a95c1e58e95c1bd9fbcc70c3b06.tar.gz
util: silence conversion warnings
timeval::tv_usec might be a 32-bit integer and timespec::tv_nsec might be a 64-bit integer. This is the case when building for recent macOS versions, for example. Just treat tv_usec as an int, which should hopefully always be sufficient on systems with `HAVE_CLOCK_GETTIME_MONOTONIC`. Closes https://github.com/curl/curl/pull/5695
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/testutil.c2
-rw-r--r--tests/server/util.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/libtest/testutil.c b/tests/libtest/testutil.c
index 94a0b46be..d40603d91 100644
--- a/tests/libtest/testutil.c
+++ b/tests/libtest/testutil.c
@@ -55,7 +55,7 @@ struct timeval tutil_tvnow(void)
struct timespec tsnow;
if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
now.tv_sec = tsnow.tv_sec;
- now.tv_usec = tsnow.tv_nsec / 1000;
+ now.tv_usec = (int)(tsnow.tv_nsec / 1000);
}
/*
** Even when the configure process has truly detected monotonic clock
diff --git a/tests/server/util.c b/tests/server/util.c
index 577a56cb2..8e76f0c9b 100644
--- a/tests/server/util.c
+++ b/tests/server/util.c
@@ -475,7 +475,7 @@ static struct timeval tvnow(void)
struct timespec tsnow;
if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
now.tv_sec = tsnow.tv_sec;
- now.tv_usec = tsnow.tv_nsec / 1000;
+ now.tv_usec = (int)(tsnow.tv_nsec / 1000);
}
/*
** Even when the configure process has truly detected monotonic clock