Commit 933198c5 authored by puuu's avatar puuu Committed by Paul Sokolovsky
Browse files

docs/*/quickref.rst: Use new semantics of ticks_diff()

parent 1cc168d4
......@@ -83,7 +83,7 @@ Use the :mod:`time <utime>` module::
time.sleep_ms(500) # sleep for 500 milliseconds
time.sleep_us(10) # sleep for 10 microseconds
start = time.ticks_ms() # get millisecond counter
delta = time.ticks_diff(start, time.ticks_ms()) # compute time difference
delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference
Timers
------
......
......@@ -37,7 +37,7 @@ Use the :mod:`time <utime>` module::
time.sleep_ms(500) # sleep for 500 milliseconds
time.sleep_us(10) # sleep for 10 microseconds
start = time.ticks_ms() # get value of millisecond counter
delta = time.ticks_diff(start, time.ticks_ms()) # compute time difference
delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference
LEDs
----
......
......@@ -132,7 +132,7 @@ The following enables any function or method to be timed by adding an
def new_func(*args, **kwargs):
t = time.ticks_us()
result = f(*args, **kwargs)
delta = time.ticks_diff(t, time.ticks_us())
delta = time.ticks_diff(time.ticks_us(), t)
print('Function {} Time = {:6.3f}ms'.format(myname, delta/1000))
return result
return new_func
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment