auxi.core.time module

This module provides classes to manage time.

class auxi.core.time.Clock(name, description=None, start_datetime=datetime.datetime(1, 1, 1, 0, 0), timestep_period_duration=<TimePeriod.month: 7>, timestep_period_count=1)

Bases: auxi.core.objects.NamedObject

Represents a clock that provices functions to manage a ticking clock based on a time period as well as retreive the current tick’s date since the start date.

get_datetime()

Get the clock’s current datetime.

Returns:The datetime.
get_datetime_at_period_ix(ix)

Get the datetime at a given period.

Parameters:period – The index of the period.
Returns:The datetime.
reset()

Resets the clock’s timestep index to ‘0’.

tick()

Increment the clock’s timestep index.

class auxi.core.time.TimePeriod

Bases: enum.Enum

Represents a period in time.

day = <TimePeriod.day: 5>
hour = <TimePeriod.hour: 4>
millisecond = <TimePeriod.millisecond: 1>
minute = <TimePeriod.minute: 3>
month = <TimePeriod.month: 7>
second = <TimePeriod.second: 2>
week = <TimePeriod.week: 6>
year = <TimePeriod.year: 8>