[DiscordArchive] what is the reason for making Update return timePassed?
[DiscordArchive] what is the reason for making Update return timePassed?
Archived author: Tea • Posted: 2024-06-11T16:43:21.490000+00:00
Original source
what is the reason for making Update return timePassed?
Archived author: Takenbacon • Posted: 2024-06-11T16:44:28.430000+00:00
Original source
some functions want a diff, in which I'd rather give it the exact time rather than the interval
Archived author: Tea • Posted: 2024-06-11T16:44:29.989000+00:00
Original source
and what is different to existing timers in Timer.h that makes new classes neccessary?
Archived author: Takenbacon • Posted: 2024-06-11T16:46:28.844000+00:00
Original source
``` _weatherUpdateTimer.Update(t_diff);
if (_weatherUpdateTimer.Passed())
{
for (auto&& zoneInfo : _zoneDynamicInfo)
if (zoneInfo.second.DefaultWeather && !zoneInfo.second.DefaultWeather->Update(_weatherUpdateTimer.GetInterval()))
zoneInfo.second.DefaultWeather.reset();
_weatherUpdateTimer.Reset();
}```
for example would roughly translate to
``` if (uint32 const timePassed = _weatherUpdateTimer.Update(t_diff))
{
for (auto&& zoneInfo : _zoneDynamicInfo)
if (zoneInfo.second.DefaultWeather && !zoneInfo.second.DefaultWeather->Update(timePassed))
zoneInfo.second.DefaultWeather.reset();
}```
simplifying the usage
Archived author: Takenbacon • Posted: 2024-06-11T16:46:59.976000+00:00
Original source
would change the behavior of the class, don't want to break anything (currently)
Archived author: Takenbacon • Posted: 2024-06-11T17:07:20.825000+00:00
Original source
effectively just trying to reduce the amount of unnecessary code with timers. in most, if not all use cases I don't think we actually need to have Reset, Update and Passed called separately
Archived author: Takenbacon • Posted: 2024-06-11T17:08:12.958000+00:00
Original source
as well as with the template I can initialize without needing to be separately called during the constructor
Archived author: Takenbacon • Posted: 2024-06-11T17:08:21.850000+00:00
Original source
e.g. SimpleIntervalTimer<Milliseconds, 1000> _weatherUpdateTimer;
Archived author: Tea • Posted: 2024-06-11T17:34:42.243000+00:00
Original source
i would prefer to see existing uses migrated too instead of adding more timer class confusion
Archived author: Tea • Posted: 2024-06-11T17:36:50.482000+00:00
Original source
SimpleCountdownTimer looks like its just a TimeTracker that has a return value in Update