celery.utils.timeutils

    class celery.utils.timeutils.LocalTimezone

    Local time implementation taken from Python’s docs.

    Used only when UTC is not enabled.

    celery.utils.timeutils.maybe_timedelta(delta)[源代码]

    Coerces integer to timedelta if delta is an integer.

    celery.utils.timeutils.timedelta_seconds(delta)

    Convert datetime.timedelta to seconds.

    Doesn’t account for negative values.

    celery.utils.timeutils.delta_resolution(dt, delta)

    If the timedelta is in days, the datetime will be rounded to the nearest days, if the timedelta is in hours the datetime will be rounded to the nearest hour, and so on until seconds which will just return the original datetime.

    celery.utils.timeutils.remaining(start, ends_in, now=None, relative=False)[源代码]

    Calculate the remaining time for a start date and a timedelta.

    e.g. “how many seconds left for 30 seconds after start?”

    celery.utils.timeutils.rate(rate)

    Parse rate strings, such as “100/m”, “2/h” or “0.5/s” and convert them to seconds.

    celery.utils.timeutils.weekday(name)[源代码]

    Return the position of a weekday (0 - 7, where 0 is Sunday).

    Example:

    celery.utils.timeutils.humanize_seconds(secs, prefix=’’, sep=’’, now=’now’)

    Show seconds in human form, e.g. 60 is “1 minute”, 7200 is “2 hours”.

    参数:prefix – Can be used to add a preposition to the output, e.g. ‘in’ will give ‘in 1 second’, but add nothing to ‘now’.

    celery.utils.timeutils.maybe_iso8601(dt)[源代码]

    celery.utils.timeutils.is_naive(dt)

    Return True if the datetime is naive (does not have timezone information).

    celery.utils.timeutils.make_aware(dt, tz)[源代码]

    Sets the timezone for a datetime object.

    celery.utils.timeutils.localize(dt, tz)

    Convert aware datetime to another timezone.

    celery.utils.timeutils.to_utc(dt)[源代码]

    Converts naive datetime to UTC

    celery.utils.timeutils.maybe_make_aware(dt, tz=None)

    class celery.utils.timeutils.ffwd(year=None, month=None, weeks=0, weekday=None, day=None, hour=None, minute=None, second=None, microsecond=None, \*kwargs*)

    Version of relativedelta that only supports addition.

    celery.utils.timeutils.utcoffset()

    celery.utils.timeutils.maybe_s_to_ms(v)