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

Commit

Permalink
Merge pull request #45 from IdentityPython/fix-timestamp-tz
Browse files Browse the repository at this point in the history
Fix calculation of epoch that is not taking into account the timezone
  • Loading branch information
rohe authored Oct 28, 2021
2 parents 1e2ee16 + 407e90e commit cf687d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/oidcmsg/time_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ def later_than(after, before):


def utc_time_sans_frac():
return int((datetime.utcnow() - datetime(1970, 1, 1)).total_seconds())
now_timestampt = int(datetime.utcnow().timestamp())
return now_timestampt


def time_sans_frac():
Expand All @@ -372,4 +373,5 @@ def epoch_in_a_while(
"""

dt = time_in_a_while(days, seconds, microseconds, milliseconds, minutes, hours, weeks)
return int((dt - datetime(1970, 1, 1)).total_seconds())
dt_timestamp = int(dt.timestamp())
return dt_timestamp

0 comments on commit cf687d7

Please sign in to comment.