this class accumulates overtime. as time passes and the class ticks the accumulator increments its' value
in other words it is a counter that responds to the passage of time (in minutes).
from __future__ import annotations
from LivinGrimoireCoreV2 import *
class TimeAccumulator:
def __init__(self, tick: int):
self._timeGate: TimeGate = TimeGate(tick)
self._accumulator: int = 0
self._timeGate.openForPauseMinutes()
def setTick(self, tick: int):
self._timeGate.setPause(tick)
def getAccumulator(self) -> int:
return self._accumulator
def reset(self):
self._accumulator = 0
def tick(self):
if self._timeGate.isClosed():
self._timeGate.openForPauseMinutes()
self._accumulator += 1
usage in main :
tg: TimeAccumulator = TimeAccumulator(2)
for i in range(1, 60):
tg.tick()
b1.hardwareChobit.think(f'{tg.getAccumulator()}', "", "") # print
time.sleep(10)
Team Fuki
I'm sorry, I don't know much about Python but I'm wondering ...
this class accumulates overtime.
What kind of overtime ? Work overtime, sports overtime ?
this class accumulates overtime. as time passes and the class ticks the accumulator increments its' value
in other words it is a counter that responds to the passage of time (in minutes).
Why is it better than the time module ? That's already 'built in' and more accurate as well.
Anything seems possible when you don't know what you're talking about.
IDK I just personally find it comfortable to use it to recognize stand by phases in which
the program receives no data or no specific data for a certain duration.
kind of like when a parrot starts to chirp after a while of silence or bordom just to see if its' owner is still in the house.
the class builds on the time module actually:
see TimeGate class
Team Fuki
by over time I meant over the course of passing time
just run the code and see
Team Fuki
