19 lines
379 B
Python
19 lines
379 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 datetimeISO8601():
|
|
dt = machine.RTC().datetime()
|
|
|
|
return '{0:04d}-{1:02d}-{2:02d}T{4:02d}:{5:02d}:{6:02d}Z'.format(*dt)
|
|
|
|
|
|
def secondsElapsed(ticks1, ticks2):
|
|
return time.ticks_diff(ticks1, ticks2) / 1000
|