Calculate timezone offset for daylight savings time

This commit is contained in:
Ben
2020-02-14 21:23:07 +00:00
parent 68392fbfa5
commit 4dde98dad1
2 changed files with 6 additions and 1 deletions

View File

@@ -29,7 +29,10 @@ async def handle_join_server(p, penguin_id: int, login_key: str):
current_time = int(time.time())
penguin_standard_time = current_time * 1000
server_time_offset = 7
pst = pytz.timezone(p.server.config.timezone)
dt = datetime.fromtimestamp(current_time, pst)
server_time_offset = abs(int(dt.strftime('%z')) // 100)
if p.timer_active:
minutes_until_timer_end = datetime.combine(datetime.today(), p.timer_end) - datetime.now()