diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-01-18 19:36:41 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-01-18 19:36:41 +0000 |
commit | 7e46119759b7099c38f543bd38d0186b9806542f (patch) | |
tree | b31264c454e26566b2e70c2794b89d77f4e28c44 /include/inspircd.h | |
parent | 42592c0083505777e8fb8e4bf09182528229a787 (diff) |
Remove excessive gettimeofday system calls
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12293 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/inspircd.h')
-rw-r--r-- | include/inspircd.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 3d1abdee4..89f0a08ee 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -52,6 +52,7 @@ #include <map> #include <bitset> #include <set> +#include <time.h> #include "inspircd_config.h" #include "inspircd_version.h" #include "typedefs.h" @@ -222,7 +223,7 @@ class serverstats timeval LastCPU; /** Time last sample was read */ - timeval LastSampled; + timespec LastSampled; /** The constructor initializes all the counts to zero */ serverstats() @@ -282,11 +283,7 @@ class CoreExport InspIRCd /** The current time, updated in the mainloop */ - time_t TIME; - - /** The time that was recorded last time around the mainloop - */ - time_t OLDTIME; + struct timespec TIME; /** A 64k buffer used to read socket data into * NOTE: update ValidateNetBufferSize if you change this @@ -446,7 +443,11 @@ class CoreExport InspIRCd * it is much faster than calling time() directly. * @return The current time as an epoch value (time_t) */ - time_t Time(); + inline time_t Time() { return TIME.tv_sec; } + /** The fractional time at the start of this mainloop iteration (nanoseconds) */ + inline long Time_ns() { return TIME.tv_nsec; } + /** Update the current time. Don't call this unless you have reason to do so. */ + void UpdateTime(); /** Bind all ports specified in the configuration file. * @return The number of ports bound without error |