The keystone.openstack.common.timeutils Module

Time related utilities and helper functions.

keystone.openstack.common.timeutils.advance_time_delta(timedelta)

Advance overridden time using a datetime.timedelta.

keystone.openstack.common.timeutils.advance_time_seconds(seconds)

Advance overridden time by seconds.

keystone.openstack.common.timeutils.clear_time_override()

Remove the overridden time.

keystone.openstack.common.timeutils.delta_seconds(before, after)

Compute the difference in seconds between two date, time, or datetime objects (as a float, to microsecond resolution).

keystone.openstack.common.timeutils.is_newer_than(after, seconds)

Return True if after is newer than seconds.

keystone.openstack.common.timeutils.is_older_than(before, seconds)

Return True if before is older than seconds.

keystone.openstack.common.timeutils.is_soon(dt, window)

Determines if time is going to happen in the next window seconds.

Params dt:the time
Params window:minimum seconds to remain to consider the time not soon
Returns:True if expiration is within the given duration
keystone.openstack.common.timeutils.iso8601_from_timestamp(timestamp)

Returns a iso8601 formated date from timestamp

keystone.openstack.common.timeutils.isotime(at=None, subsecond=False)

Stringify time in ISO 8601 format

keystone.openstack.common.timeutils.marshall_now(now=None)

Make an rpc-safe datetime with microseconds.

Note: tzinfo is stripped, but not required for relative times.

keystone.openstack.common.timeutils.normalize_time(timestamp)

Normalize time in arbitrary timezone to UTC naive object

keystone.openstack.common.timeutils.parse_isotime(timestr)

Parse time from ISO 8601 format

keystone.openstack.common.timeutils.parse_strtime(timestr, fmt='%Y-%m-%dT%H:%M:%S.%f')

Turn a formatted time back into a datetime.

keystone.openstack.common.timeutils.set_time_override(override_time=datetime.datetime(2013, 10, 18, 20, 40, 5, 813938))

Override utils.utcnow to return a constant time or a list thereof, one at a time.

keystone.openstack.common.timeutils.strtime(at=None, fmt='%Y-%m-%dT%H:%M:%S.%f')

Returns formatted utcnow.

keystone.openstack.common.timeutils.unmarshall_time(tyme)

Unmarshall a datetime dict.

keystone.openstack.common.timeutils.utcnow()

Overridable version of utils.utcnow.

keystone.openstack.common.timeutils.utcnow_ts()

Timestamp version of our utcnow function.

Previous topic

The keystone.openstack.common.setup Module

Next topic

The keystone.openstack.common.version Module

This Page