MCPcopy
hub / github.com/celery/celery / to_utc

Function to_utc

celery/utils/time.py:372–374  ·  view source on GitHub ↗

Convert naive :class:`~datetime.datetime` to UTC.

(dt: datetime)

Source from the content-addressed store, hash-verified

370
371
372def to_utc(dt: datetime) -> datetime:
373 """Convert naive :class:`~datetime.datetime` to UTC."""
374 return make_aware(dt, timezone.utc)
375
376
377def maybe_make_aware(dt: datetime, tz: tzinfo | None = None,

Callers 5

test_countdown_to_etaMethod · 0.90
test_nowMethod · 0.90
nowMethod · 0.90
maybe_make_awareFunction · 0.85

Calls 1

make_awareFunction · 0.85

Tested by 3

test_countdown_to_etaMethod · 0.72
test_nowMethod · 0.72