Skip to content

Commit 9ff84a2

Browse files
committed
use time.time() instead for datetime.now(timezone.utc).timestamp() for better performance
1 parent aa29de1 commit 9ff84a2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/cryptojwt/jwt.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"""Basic JSON Web Token implementation."""
22
import json
33
import logging
4+
import time
45
import uuid
5-
from datetime import datetime
6-
from datetime import timezone
76
from json import JSONDecodeError
87

98
from .exception import HeaderError
@@ -28,9 +27,7 @@ def utc_time_sans_frac():
2827
2928
:return: A number of seconds
3029
"""
31-
32-
now_timestampt = int(datetime.now(timezone.utc).timestamp())
33-
return now_timestampt
30+
return int(time.time())
3431

3532

3633
def pick_key(keys, use, alg="", key_type="", kid=""):

0 commit comments

Comments
 (0)