[docs]classClock(object):"""A class to track the time for a process. Attributes ---------- start : int The time of start for the clock. step : int The time of the process the clock is at currently. Methods ------- now(format=None) Gets the current time in the provided format. increment() Increments the clock by specified time increment. reset() Resets the clock. """def__init__(self):self.start=0self.step=self.start
[docs]defnow(self,format:str=None)->datetime:"""Gets the current time in the provided format. Parameters ---------- format : str or None, optional The format to put the current time into. Returns ------- datetime The current time. """returndatetime.now().strftime(format)ifformatelsedatetime.now()
[docs]defincrement(self)->None:"""Increments the clock by specified time increment."""self.step+=1
[docs]defreset(self)->None:"""Resets the clock."""self.step=self.start