diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/anope.h | 5 | ||||
| -rw-r--r-- | include/channels.h | 4 | ||||
| -rw-r--r-- | include/modules.h | 2 | ||||
| -rw-r--r-- | include/regchannel.h | 4 | ||||
| -rw-r--r-- | include/services.h | 2 | ||||
| -rw-r--r-- | include/sockets.h | 11 | ||||
| -rw-r--r-- | include/timers.h | 4 |
7 files changed, 24 insertions, 8 deletions
diff --git a/include/anope.h b/include/anope.h index a2cdc2d06..51a80a598 100644 --- a/include/anope.h +++ b/include/anope.h @@ -288,6 +288,11 @@ namespace Anope static const char *const compiled = __TIME__ " " __DATE__; + /** The current system time, which is pretty close to being accurate. + * Use this unless you need very specific time checks + */ + static time_t CurTime = time(NULL); + extern CoreExport string Version(); extern CoreExport string Build(); diff --git a/include/channels.h b/include/channels.h index ec886c9ca..73c97d3aa 100644 --- a/include/channels.h +++ b/include/channels.h @@ -23,7 +23,7 @@ struct UserData void Clear() { - last_use = last_start = time(NULL); + last_use = last_start = Anope::CurTime; lines = times = 0; lastline.clear(); } @@ -77,7 +77,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> * @param name The channel name * @param ts The time the channel was created */ - Channel(const Anope::string &nname, time_t ts = time(NULL)); + Channel(const Anope::string &nname, time_t ts = Anope::CurTime); /** Default destructor */ diff --git a/include/modules.h b/include/modules.h index e1675c7e6..60a16a978 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1237,7 +1237,7 @@ class CallBack : public Timer private: Module *m; public: - CallBack(Module *mod, long time_from_now, time_t now = time(NULL), bool repeating = false) : Timer(time_from_now, now, repeating), m(mod) + CallBack(Module *mod, long time_from_now, time_t now = Anope::CurTime, bool repeating = false) : Timer(time_from_now, now, repeating), m(mod) { m->CallBacks.push_back(this); } diff --git a/include/regchannel.h b/include/regchannel.h index 80b25abfb..fb6810220 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -171,7 +171,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, * @param t The time the akick was added, defaults to now * @param lu The time the akick was last used, defaults to never */ - AutoKick *AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = time(NULL), time_t lu = 0); + AutoKick *AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0); /** Add an akick entry to the channel by reason * @param user The user who added the akick @@ -180,7 +180,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, * @param t The time the akick was added, defaults to now * @param lu The time the akick was last used, defaults to never */ - AutoKick *AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = time(NULL), time_t lu = 0); + AutoKick *AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0); /** Get an entry from the channel akick list * @param index The index in the akick vector diff --git a/include/services.h b/include/services.h index ada2a5c6a..e0ed8709f 100644 --- a/include/services.h +++ b/include/services.h @@ -509,7 +509,7 @@ class CoreExport HostInfo * @param creator Who created the vhost * @param time When the vhost was craated */ - void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = time(NULL)); + void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime); /** Remove a users vhost **/ diff --git a/include/sockets.h b/include/sockets.h index 772a08a65..6caeea19c 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -60,8 +60,19 @@ union CoreExport sockaddrs /* The same as above but not */ inline bool operator!=(const sockaddrs &other) const { return !(*this == other); } + /** The equivalent of inet_pton + * @param type AF_INET or AF_INET6 + * @param address The address to place in the sockaddr structures + * @param pport An option port to include in the sockaddr structures + * @throws A socket exception if given invalid IPs + */ void pton(int type, const Anope::string &address, int pport = 0); + /** The equivalent of inet_ntop + * @param type AF_INET or AF_INET6 + * @param address The in_addr or in_addr6 structure + * @throws A socket exception if given an invalid structure + */ void ntop(int type, const void *src); }; diff --git a/include/timers.h b/include/timers.h index 79443d753..433f8adcd 100644 --- a/include/timers.h +++ b/include/timers.h @@ -42,7 +42,7 @@ class CoreExport Timer : public Extensible * @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 = time(NULL), bool repeating = false); + Timer(long time_from_now, time_t now = Anope::CurTime, bool repeating = false); /** Default destructor, removes the timer from the list */ @@ -103,7 +103,7 @@ class CoreExport TimerManager : public Extensible /** Tick all pending timers * @param ctime The current time */ - static void TickTimers(time_t ctime = time(NULL)); + static void TickTimers(time_t ctime = Anope::CurTime); /** Compares two timers */ |
