From db34c25bb4b1376ab931ca992e3e794d8eac8452 Mon Sep 17 00:00:00 2001 From: sickprodigy Date: Wed, 5 Nov 2025 22:54:17 -0500 Subject: [PATCH] Add NTP time synchronization after WiFi connection --- main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.py b/main.py index 072853c..b146345 100644 --- a/main.py +++ b/main.py @@ -77,6 +77,14 @@ if wifi and wifi.isconnected(): # Send startup message with IP send_discord_message(f"Pico W online at http://{ifconfig[0]} ✅") + + # Sync time with NTP + try: + import ntptime + ntptime.settime() + print("Time synced with NTP server") + except Exception as e: + print("Failed to sync time: {}".format(e)) else: print("\n" + "="*50) print("WiFi Connection Failed!")