Skip to content
Snippets Groups Projects
Commit 6abafca1 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

esp8266/modutime: Support float argument to time.sleep().

parent a4c8ef9d
No related branches found
No related tags found
No related merge requests found
......@@ -102,7 +102,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(time_mktime_obj, time_mktime);
/// \function sleep(seconds)
/// Sleep for the given number of seconds.
STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
#if MICROPY_PY_BUILTINS_FLOAT
mp_hal_delay_ms(1000 * mp_obj_get_float(seconds_o));
#else
mp_hal_delay_ms(1000 * mp_obj_get_int(seconds_o));
#endif
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment