Browse Source

cc3200: time.sleep() now receives seconds, like CPython.

pull/1358/merge
Daniel Campora 9 years ago
parent
commit
5161239c9f
  1. 8
      cc3200/mods/modutime.c
  2. 8
      docs/library/time.rst

8
cc3200/mods/modutime.c

@ -122,10 +122,10 @@ STATIC mp_obj_t time_mktime(mp_obj_t tuple) {
MP_DEFINE_CONST_FUN_OBJ_1(time_mktime_obj, time_mktime);
/// \function sleep(milliseconds)
/// Sleep for the given number of milliseconds.
STATIC mp_obj_t time_sleep(mp_obj_t milliseconds_o) {
HAL_Delay(mp_obj_get_int(milliseconds_o));
/// \function sleep(seconds)
/// Sleep for the given number of seconds.
STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
HAL_Delay(mp_obj_get_int(seconds_o) * 1000);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep);

8
docs/library/time.rst

@ -38,18 +38,12 @@ Functions
Sleep for the given number of seconds. Seconds can be a floating-point number to
sleep for a fractional number of seconds.
.. only:: port_esp8266
.. only:: port_esp8266 or port_wipy
.. function:: sleep(seconds)
Sleep for the given number of seconds.
.. only:: port_wipy
.. function:: sleep(milliseconds)
Sleep for the given number of milliseconds.
.. function:: time()
Returns the number of seconds, as an integer, since 1/1/2000.

Loading…
Cancel
Save