author | Florian Forster <octo@collectd.org> | |
Fri, 21 Aug 2015 09:56:57 +0000 (11:56 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 21 Aug 2015 09:56:57 +0000 (11:56 +0200) | ||
commit | 45e631cf6134de4a5dd3bcf01794c9fdd539c412 | |
tree | 071f9c5bc795a9211fe51530f2997aa9633b2f92 | tree | snapshot |
parent | db1391aaa66b8b8fad82219494f61f3452441f62 | commit | diff |
src/daemon/utils_time.h: Treat nanoseconds as 64bit integer.
The assumed type was "long", because that is what struct timespec is
using. However, struct timespec only stores the fraction of a second in
the approrpiate field and therefore only cares about values up to 10^9.
We, on the other hand, assume a UNIX epoch in ns precision, so we
require the entire 64bits.
This patch changes the [MUN]S_TO_CDTIME_T() macros to assume a uint64_t
input and moves the casting to the appropriate data type for struct
time{val,spec} to the CDTIME_T_TO_TIME{VAL,SPEC}() macros. Appropriate
casts are added to the cURL based plugins which need to pass a "long" to
cURL when specifying timeouts.
It also fixes the unit test, which assigned large (> 32 bit) literals to
a "long" field, which breaks on 32 bit architectures.
The assumed type was "long", because that is what struct timespec is
using. However, struct timespec only stores the fraction of a second in
the approrpiate field and therefore only cares about values up to 10^9.
We, on the other hand, assume a UNIX epoch in ns precision, so we
require the entire 64bits.
This patch changes the [MUN]S_TO_CDTIME_T() macros to assume a uint64_t
input and moves the casting to the appropriate data type for struct
time{val,spec} to the CDTIME_T_TO_TIME{VAL,SPEC}() macros. Appropriate
casts are added to the cURL based plugins which need to pass a "long" to
cURL when specifying timeouts.
It also fixes the unit test, which assigned large (> 32 bit) literals to
a "long" field, which breaks on 32 bit architectures.
src/apache.c | diff | blob | history | |
src/ascent.c | diff | blob | history | |
src/bind.c | diff | blob | history | |
src/curl.c | diff | blob | history | |
src/curl_json.c | diff | blob | history | |
src/curl_xml.c | diff | blob | history | |
src/daemon/utils_time.h | diff | blob | history | |
src/daemon/utils_time_test.c | diff | blob | history | |
src/nginx.c | diff | blob | history |