summaryrefslogtreecommitdiff
path: root/ports/unix/modusocket.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/unix/modusocket.c')
-rw-r--r--ports/unix/modusocket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/unix/modusocket.c b/ports/unix/modusocket.c
index 8bc453d42..f87a717c9 100644
--- a/ports/unix/modusocket.c
+++ b/ports/unix/modusocket.c
@@ -378,8 +378,8 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
if (timeout_in != mp_const_none) {
#if MICROPY_PY_BUILTINS_FLOAT
mp_float_t val = mp_obj_get_float(timeout_in);
- double ipart;
- tv.tv_usec = round(modf(val, &ipart) * 1000000);
+ mp_float_t ipart;
+ tv.tv_usec = MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(modf)(val, &ipart) * MICROPY_FLOAT_CONST(1000000.));
tv.tv_sec = ipart;
#else
tv.tv_sec = mp_obj_get_int(timeout_in);