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:
parent
f2c88e037c
commit
0101affb68
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user