simulator: Better align simulator RTC API with the nRF API
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
d695981323
commit
62bca4d288
1 changed files with 6 additions and 1 deletions
|
@ -15,6 +15,7 @@ sys.print_exception = print_exception
|
||||||
import array
|
import array
|
||||||
import draw565
|
import draw565
|
||||||
import os
|
import os
|
||||||
|
import warnings
|
||||||
|
|
||||||
from machine import I2C
|
from machine import I2C
|
||||||
from machine import Pin
|
from machine import Pin
|
||||||
|
@ -108,11 +109,15 @@ class RTC(object):
|
||||||
self._lasttime = now
|
self._lasttime = now
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def set_localtime(self, t):
|
||||||
|
"""Set the current wall time."""
|
||||||
|
warnings.warn('set_localtime() is not supported on simulator')
|
||||||
|
|
||||||
def get_localtime(self):
|
def get_localtime(self):
|
||||||
#if self.uptime < 60:
|
#if self.uptime < 60:
|
||||||
# # Jump back a little over a day
|
# # Jump back a little over a day
|
||||||
# return time.localtime(time.time() - 100000)
|
# return time.localtime(time.time() - 100000)
|
||||||
return time.localtime()
|
return time.localtime()[:8]
|
||||||
|
|
||||||
def get_time(self):
|
def get_time(self):
|
||||||
now = self.get_localtime()
|
now = self.get_localtime()
|
||||||
|
|
Loading…
Reference in a new issue