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

@ -25,6 +25,8 @@ if __name__ == '__main__':
nargs='*', help='Plugins to load')
parser.add_argument('-l', '--lang', action='store', default='en', help='Houdini language',
choices=['en', 'fr', 'pt', 'es', 'de', 'ru'])
parser.add_argument('-tz', '--timezone', action='store', default='America/Vancouver',
help='Server timezone')
login_group = parser.add_argument_group('login')
login_group.add_argument('--login-failure-limit', action='store', default=5, help='Limit before flood limit',

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()