Since yesterday, suddenly, ntptime.settime() don’t works, It give me these returns:
>>> %Run -c $EDITOR_CONTENT Connection successful ('192.168.1.102', '255.255.255.0', '192.168.1.1', '163.172.213.136') Local time before synchronization:(2023, 10, 17, 16, 43, 39, 1, 290) Traceback (most recent call last): File "<stdin>", line 21, in <module> File "ntptime.py", line 34, in settime File "ntptime.py", line 20, in time OSError: -202 >>>
I don’t know what happens, this script always worked fine till yesterday !!!
Is it a server problem ?
Does anybody has this kind of issue ?
Hi.
What script are you referring to? Can you provide more details?
Regards,
Sar
Hi Sara,
Nice to hear you !
Her is my script which is largerely based on your examples :
from micropython import *
import time
import ntptime
import network
ssid = ‘xxxxxxxx’
password = ‘xxxxxxxxxxxxxx’
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(ssid, password)
while station.isconnected() == False:
pass
print(‘Connection successful’)
print(station.ifconfig())
print(“Local time before synchronization:%s” %str(time.localtime()))
ntptime.settime()
print(“Local time after synchronization:%s” %str(time.localtime()))
don’t take in account my message on “Contact Support”
Best regards
Hi.
I’m sorry, but I don’t think we have any examples that use NTP. Can you refer to the project example you’re referring to?
Maybe the internet connection to the server is taking some time, and it can’t get the time because it it not connected to the server yet?
Check the following discussion: https://forum.micropython.org/viewtopic.php?t=2440
and check the suggestion to connect your board to the internet and make sure it is connected before proceeding.
Regards,
Sara