77# from picographics import PicoGraphics, DISPLAY_INKY_FRAME_4 as DISPLAY # 4.0"
88from picographics import PicoGraphics , DISPLAY_INKY_FRAME_7 as DISPLAY # 7.3"
99
10+ # Set tz_offset to be the number of hours off of UTC for your local zone.
11+ # Examples: tz_offset = -7 # Pacific time (PST)
12+ # tz_offset = 1 # CEST (Paris)
13+ tz_offset = 0
14+ tz_seconds = tz_offset * 3600
15+
1016# Sync the Inky (always on) RTC to the Pico W so that "time.localtime()" works.
1117inky_frame .pcf_to_pico_rtc ()
1218
3642 def status_handler (mode , status , ip ):
3743 print (mode , status , ip )
3844
39- year , month , day , hour , minute , second , dow , _ = time .localtime ()
45+ year , month , day , hour , minute , second , dow , _ = time .localtime (time . time () + tz_seconds )
4046
4147 # Connect to the network and get the time if it's not set
4248 if year < 2023 :
@@ -60,7 +66,7 @@ def status_handler(mode, status, ip):
6066 graphics .text ("Failed to connect!" , 0 , 40 )
6167
6268 # Display the date and time
63- year , month , day , hour , minute , second , dow , _ = time .localtime ()
69+ year , month , day , hour , minute , second , dow , _ = time .localtime (time . time () + tz_seconds )
6470
6571 date_time = f"{ year :04} /{ month :02} /{ day :02} { hour :02} :{ minute :02} :{ second :02} "
6672
0 commit comments