Skip to content

Commit 39ce0e0

Browse files
committed
fix: timezone in docker
1 parent dab7165 commit 39ce0e0

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

app/graph/graph_24hr.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import matplotlib.pyplot as plt
22
import matplotlib.dates as mdates
33
import datetime
4+
import pytz
45
import os
56

67
def 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')

app/services/clock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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):

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pydantic_core==2.33.2
2626
pyparsing==3.2.5
2727
python-dateutil==2.9.0.post0
2828
python-dotenv==1.2.1
29+
pytz==2025.2
2930
schedule==1.2.2
3031
six==1.17.0
3132
typing-inspection==0.4.2

0 commit comments

Comments
 (0)