Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 03c1c05

Browse files
authored
Merge pull request #53 from IdentityPython/timezone_awarness
Timezone awareness
2 parents abbf83b + 40ae4c3 commit 03c1c05

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def run_tests(self):
6767
"Programming Language :: Python :: 3.8",
6868
"Topic :: Software Development :: Libraries :: Python Modules"],
6969
install_requires=[
70-
"cryptojwt>=1.5.2",
70+
"cryptojwt==1.6.0",
7171
"pyOpenSSL",
7272
"filelock>=3.0.12",
7373
'pyyaml>=5.1.2'

src/oidcmsg/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "Roland Hedberg"
2-
__version__ = "1.5.2"
2+
__version__ = "1.5.3"
33

44
import os
55
from typing import Dict

src/oidcmsg/time_util.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import time
2727
from datetime import datetime
2828
from datetime import timedelta
29+
from datetime import timezone
2930

3031
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
3132
TIME_FORMAT_WITH_FRAGMENT = re.compile("^(\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2})\.\d*Z$")
@@ -181,7 +182,8 @@ def time_in_a_while(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0
181182
:return: datetime instance using UTC time
182183
"""
183184
delta = timedelta(days, seconds, microseconds, milliseconds, minutes, hours, weeks)
184-
return datetime.utcnow() + delta
185+
res = datetime.now(timezone.utc) + delta
186+
return res.replace(tzinfo=None)
185187

186188

187189
def time_a_while_ago(
@@ -200,7 +202,8 @@ def time_a_while_ago(
200202
:return: datetime instance using UTC time
201203
"""
202204
delta = timedelta(days, seconds, microseconds, milliseconds, minutes, hours, weeks)
203-
return datetime.utcnow() - delta
205+
res = datetime.now(timezone.utc) - delta
206+
return res.replace(tzinfo=None)
204207

205208

206209
def in_a_while(
@@ -351,7 +354,7 @@ def later_than(after, before):
351354

352355

353356
def utc_time_sans_frac():
354-
now_timestampt = int(datetime.utcnow().timestamp())
357+
now_timestampt = int(datetime.now(timezone.utc).timestamp())
355358
return now_timestampt
356359

357360

0 commit comments

Comments
 (0)