7
7
# from picographics import PicoGraphics, DISPLAY_INKY_FRAME_4 as DISPLAY # 4.0"
8
8
from picographics import PicoGraphics , DISPLAY_INKY_FRAME_7 as DISPLAY # 7.3"
9
9
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
+
10
16
# Sync the Inky (always on) RTC to the Pico W so that "time.localtime()" works.
11
17
inky_frame .pcf_to_pico_rtc ()
12
18
36
42
def status_handler (mode , status , ip ):
37
43
print (mode , status , ip )
38
44
39
- year , month , day , hour , minute , second , dow , _ = time .localtime ()
45
+ year , month , day , hour , minute , second , dow , _ = time .localtime (time . time () + tz_seconds )
40
46
41
47
# Connect to the network and get the time if it's not set
42
48
if year < 2023 :
@@ -60,7 +66,7 @@ def status_handler(mode, status, ip):
60
66
graphics .text ("Failed to connect!" , 0 , 40 )
61
67
62
68
# 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 )
64
70
65
71
date_time = f"{ year :04} /{ month :02} /{ day :02} { hour :02} :{ minute :02} :{ second :02} "
66
72
0 commit comments