File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 11import matplotlib .pyplot as plt
22import matplotlib .dates as mdates
33import datetime
4+ import pytz
45import os
56
67def graph_cpu_load (db_report ):
7- now = datetime .datetime .now ()
8+ tz = pytz .timezone ('America/New_York' )
9+ now = datetime .datetime .now (tz = tz ) # ← Add timezone here
810 window_start = now - datetime .timedelta (hours = 24 )
911
1012 time = []
1113 load = []
1214
1315 for entry in db_report :
14- dt = datetime .datetime .fromtimestamp (entry ['timestamp' ])
16+ dt = datetime .datetime .fromtimestamp (entry ['timestamp' ], tz = tz )
1517 time .append (dt )
1618 load .append (entry ['cpu_prcnt' ])
1719
@@ -28,7 +30,6 @@ def graph_cpu_load(db_report):
2830 plt .gcf ().autofmt_xdate ()
2931
3032 plt .grid (True , alpha = 0.5 , color = 'gray' )
31- #plt.ylim(0, 100)
3233
3334 script_dir = os .path .dirname (os .path .abspath (__file__ ))
3435 save_path = os .path .join (script_dir , 'cpu_load.png' )
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ async def five_min_clock(self):
1111 self .five_min_event .set ()
1212 await asyncio .sleep (1 )
1313 self .five_min_event .clear ()
14- await asyncio .sleep (20 )
14+ await asyncio .sleep (300 )
1515 print ("Five minute clock triggered" )
1616
1717 async def day_cycle_clock (self ):
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ pydantic_core==2.33.2
2626pyparsing == 3.2.5
2727python-dateutil == 2.9.0.post0
2828python-dotenv == 1.2.1
29+ pytz == 2025.2
2930schedule == 1.2.2
3031six == 1.17.0
3132typing-inspection == 0.4.2
You can’t perform that action at this time.
0 commit comments