TimeUtilities

Backward compatibility wrapper - moved to DIRACCommon

This module has been moved to DIRACCommon.Core.Utilities.TimeUtilities to avoid circular dependencies and allow DiracX to use these utilities without triggering DIRAC’s global state initialization.

All exports are maintained for backward compatibility.

class DIRAC.Core.Utilities.TimeUtilities.DiracTime

Bases: object

datetime tools for DIRAC: There are a number of facilities in DIRAC which can’t handle timezone aware dateetime objects: These don’t serialise, don’t fit in database schemas, etc. As the python non-timezone aware helper functions are being deprecated we provider our own equivalents here.

static timestamp_utc(dt: datetime) int

Converts a datetime object to a UTC epoch offset int. Naive timezones are assumed to be UTC.

static utcfromtimestamp(epoch: float) datetime

Returns a UTC datetime object from the given epoch offset (also in UTC).

static utcnow() datetime

Returns a UTC datetime object for now without a timezone field.