• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ntp don’t works anymore !!

Q&A Forum › ntp don’t works anymore !!
0 Vote Up Vote Down
Philippe asked 2 years ago

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 ?

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
What script are you referring to? Can you provide more details?
Regards,
Sar

0 Vote Up Vote Down
Philippe answered 2 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

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

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.