MCPcopy
hub / github.com/pyca/cryptography / _convert_to_naive_utc_time

Function _convert_to_naive_utc_time

src/cryptography/x509/base.py:80–91  ·  view source on GitHub ↗

Normalizes a datetime to a naive datetime in UTC. time -- datetime to normalize. Assumed to be in UTC if not timezone aware.

(time: datetime.datetime)

Source from the content-addressed store, hash-verified

78
79
80def _convert_to_naive_utc_time(time: datetime.datetime) -> datetime.datetime:
81 """Normalizes a datetime to a naive datetime in UTC.
82
83 time -- datetime to normalize. Assumed to be in UTC if not timezone
84 aware.
85 """
86 if time.tzinfo is not None:
87 offset = time.utcoffset()
88 offset = offset if offset else datetime.timedelta()
89 return time.replace(tzinfo=None) - offset
90 else:
91 return time
92
93
94class Attribute:

Callers 5

not_valid_beforeMethod · 0.85
not_valid_afterMethod · 0.85
last_updateMethod · 0.85
next_updateMethod · 0.85
revocation_dateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected