summaryrefslogtreecommitdiff
path: root/include/timers.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/timers.h')
-rw-r--r--include/timers.h38
1 files changed, 12 insertions, 26 deletions
diff --git a/include/timers.h b/include/timers.h
index 0e3570a14..3615074df 100644
--- a/include/timers.h
+++ b/include/timers.h
@@ -9,49 +9,42 @@
* Based on the original code of Services by Andy Church.
*/
-#ifndef TIMERS_H
-#define TIMERS_H
+#pragma once
#include "anope.h"
class CoreExport Timer
{
- private:
+private:
/** The owner of the timer, if any
*/
- Module *owner;
-
- /** The time this was created
- */
- time_t settime;
+ Module *owner = nullptr;
/** The triggering time
*/
time_t trigger;
- /** Numer of seconds between triggers
+ /** Number of seconds between triggers
*/
- long secs;
+ time_t secs;
/** True if this is a repeating timer
*/
bool repeat;
- public:
+public:
/** Constructor, initializes the triggering time
* @param time_from_now The number of seconds from now to trigger the timer
- * @param now The time now
* @param repeating Repeat this timer every time_from_now if this is true
*/
- Timer(long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
+ Timer(time_t time_from_now, bool repeating = false);
/** Constructor, initializes the triggering time
* @param creator The creator of the timer
* @param time_from_now The number of seconds from now to trigger the timer
- * @param now The time now
* @param repeating Repeat this timer every time_from_now if this is true
*/
- Timer(Module *creator, long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
+ Timer(Module *creator, time_t time_from_now, bool repeating = false);
/** Destructor, removes the timer from the list
*/
@@ -82,11 +75,6 @@ class CoreExport Timer
*/
long GetSecs() const;
- /** Returns the time this timer was created
- * @return The time this timer was created
- */
- time_t GetSetTime() const;
-
/** Returns the owner of this timer, if any
* @return The owner of the timer
*/
@@ -95,19 +83,19 @@ class CoreExport Timer
/** Called when the timer ticks
* This should be overridden with something useful
*/
- virtual void Tick(time_t ctime) = 0;
+ virtual void Tick() = 0;
};
/** This class manages sets of Timers, and triggers them at their defined times.
* This will ensure timers are not missed, as well as removing timers that have
* expired and allowing the addition of new ones.
*/
-class CoreExport TimerManager
+class CoreExport TimerManager final
{
/** A list of timers
*/
static std::multimap<time_t, Timer *> Timers;
- public:
+public:
/** Add a timer to the list
* @param t A Timer derived class to add
*/
@@ -121,11 +109,9 @@ class CoreExport TimerManager
/** Tick all pending timers
* @param ctime The current time
*/
- static void TickTimers(time_t ctime = Anope::CurTime);
+ static void TickTimers();
/** Deletes all timers owned by the given module
*/
static void DeleteTimersFor(Module *m);
};
-
-#endif // TIMERS_H