MCPcopy
hub / github.com/benoitc/gunicorn / _RequestTime

Class _RequestTime

gunicorn/asgi/protocol.py:27–38  ·  view source on GitHub ↗

Lightweight request time container compatible with logging atoms. Uses time.monotonic() elapsed seconds instead of datetime.now() syscalls. Provides .seconds and .microseconds attributes for glogging.py compatibility.

Source from the content-addressed store, hash-verified

25
26
27class _RequestTime:
28 """Lightweight request time container compatible with logging atoms.
29
30 Uses time.monotonic() elapsed seconds instead of datetime.now() syscalls.
31 Provides .seconds and .microseconds attributes for glogging.py compatibility.
32 """
33
34 __slots__ = ('seconds', 'microseconds')
35
36 def __init__(self, elapsed):
37 self.seconds = int(elapsed)
38 self.microseconds = int((elapsed - self.seconds) * 1_000_000)
39
40
41def _normalize_sockaddr(sockaddr):

Calls

no outgoing calls