Pycom WiPy 3.0 Manual page 380

Hide thumbs Also See for WiPy 3.0:
Table of Contents

Advertisement

5.3.14 utime
measure arbitrarily long periods of time (because
usually would have short period). The expected usage pattern is implementing event polling
with timeout:
# Wait for GPIO pin to be asserted, but at most 500us
start = time.ticks_us()
while pin.value() == 0:
if time.ticks_diff(start, time.ticks_us()) > 500:
raise TimeoutError
utime.time()
Returns the number of seconds, as an integer, since the Epoch, assuming that underlying
RTC is set. If an RTC is not set, this function returns number of seconds since power up or
reset). If you want to develop portable MicroPython application, you should not rely on this
function to provide higher than second precision. If you need higher precision, use
and
ticks_ms()
ticks_us()
argument is a better choice.
utime.timezone([secs])
Set or get the timezone offset, in seconds. If
value.
In MicroPython,
time.timezone
local time, you write
.
= utc + timezone
functions, if you need calendar time,
works the opposite way to Python. In Python, to get the
local_time = utc - timezone
functions wrap around and
ticks_*()
is not provided, it returns the current
secs
, while in MicroPython it is
without an
localtime()
local_time
380

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the WiPy 3.0 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

SipyGpyLopyLopy4Fipy

Table of Contents