23 lines
468 B
Python
23 lines
468 B
Python
import machine
|
|
import time
|
|
|
|
|
|
def datetime():
|
|
dt = machine.RTC().datetime()
|
|
|
|
return '{0:04d}-{1:02d}-{2:02d} {4:02d}:{5:02d}:{6:02d} UTC'.format(*dt)
|
|
|
|
|
|
def datetime_iso8601():
|
|
dt = machine.RTC().datetime()
|
|
|
|
return '{0:04d}-{1:02d}-{2:02d}T{4:02d}:{5:02d}:{6:02d}Z'.format(*dt)
|
|
|
|
|
|
def seconds_elapsed(ticks1, ticks2):
|
|
return time.ticks_diff(ticks1, ticks2) / 1000
|
|
|
|
|
|
def milliseconds_elapsed(ticks1, ticks2):
|
|
return time.ticks_diff(ticks1, ticks2)
|