MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / getTicksBetween

Method getTicksBetween

game/state/gametime.cpp:190–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188unsigned int GameTime::getSeconds() const { return getPtime(this->ticks).time_of_day().seconds(); }
189
190unsigned int GameTime::getTicksBetween(unsigned int fromDays, unsigned int fromHours,
191 unsigned int fromMinutes, unsigned int fromSeconds,
192 unsigned int toDays, unsigned int toHours,
193 unsigned int toMinutes, unsigned int toSeconds) const
194{
195 if (fromDays <= toDays && fromHours <= toHours && fromMinutes <= toMinutes &&
196 fromSeconds < toSeconds)
197 {
198 unsigned int days_diff_in_ticks = (toDays - fromDays) * TICKS_PER_DAY;
199 unsigned int hours_diff_in_ticks = (toHours - fromHours) * TICKS_PER_HOUR;
200 unsigned int minutes_diff_in_ticks = (toMinutes - fromMinutes) * TICKS_PER_MINUTE;
201 unsigned int seconds_diff_in_ticks = (toSeconds - fromSeconds) * TICKS_PER_SECOND;
202
203 return days_diff_in_ticks + hours_diff_in_ticks + minutes_diff_in_ticks +
204 seconds_diff_in_ticks;
205 }
206 else
207 return 0;
208}
209
210uint64_t GameTime::getTicks() const { return ticks; }
211

Callers 1

eventOccurredMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected