Skip to content

Commit

Permalink
math module need for float max
Browse files Browse the repository at this point in the history
  • Loading branch information
JalonSolov committed Jan 26, 2024
1 parent 6c81fb3 commit 4b63a1e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/uptime/uptime.c.v
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import math
import common

#include <time.h>
Expand Down Expand Up @@ -34,7 +35,7 @@ fn print_uptime(utmp_buf []C.utmpx) ! {
endptr := &char(0)
upsecs := C.strtod(&buf[0], &endptr)
if buf.bytestr() != endptr.vstring() {
if 0 <= upsecs && upsecs < max_f64 {
if 0 <= upsecs && upsecs < math.max_f64 {
uptime = i64(upsecs)
} else {
uptime = -1
Expand Down

0 comments on commit 4b63a1e

Please sign in to comment.