unix: fix uv_uptime() regression

As it was in the original version of
https://github.com/libuv/libuv/pull/3072, `%lf` must be used in
`sscanf()` as the value is being stored in a `double` and not a `float`.

PR-URL: https://github.com/libuv/libuv/pull/3080
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Santiago Gimeno 2020-12-28 22:54:04 +01:00
parent f2c88e037c
commit 0101affb68
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE

View File

@ -636,7 +636,7 @@ int uv_uptime(double* uptime) {
/* Try /proc/uptime first, then fallback to clock_gettime(). */
if (0 == uv__slurp("/proc/uptime", buf, sizeof(buf)))
if (1 == sscanf(buf, "%f", uptime))
if (1 == sscanf(buf, "%lf", uptime))
return 0;
/* Try CLOCK_BOOTTIME first, fall back to CLOCK_MONOTONIC if not available