]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/time/gadgets.cc
SourceLayout: Move time related tools to time/libtime.la (#1001)
[thirdparty/squid.git] / src / time / gadgets.cc
similarity index 90%
rename from src/time.cc
rename to src/time/gadgets.cc
index 5fd1236588600c26abd35a1f543e84bd6a534fca..4b75fd2c4ef7d2359517b9b1cb853c5ea8e95007 100644 (file)
@@ -9,7 +9,7 @@
 /* DEBUG: section 21    Time Functions */
 
 #include "squid.h"
-#include "SquidTime.h"
+#include "time/gadgets.h"
 
 #include <iomanip>
 #include <ostream>
@@ -19,7 +19,7 @@ double current_dtime;
 time_t squid_curtime = 0;
 
 time_t
-getCurrentTime(void)
+getCurrentTime()
 {
 #if GETTIMEOFDAY_NO_TZP
     gettimeofday(&current_time);
@@ -33,6 +33,20 @@ getCurrentTime(void)
     return squid_curtime = current_time.tv_sec;
 }
 
+int
+tvSubUsec(struct timeval t1, struct timeval t2)
+{
+    return (t2.tv_sec - t1.tv_sec) * 1000000 +
+           (t2.tv_usec - t1.tv_usec);
+}
+
+double
+tvSubDsec(struct timeval t1, struct timeval t2)
+{
+    return (double) (t2.tv_sec - t1.tv_sec) +
+           (double) (t2.tv_usec - t1.tv_usec) / 1000000.0;
+}
+
 int
 tvSubMsec(struct timeval t1, struct timeval t2)
 {
@@ -72,15 +86,6 @@ void tvAssignAdd(struct timeval &t, struct timeval const &add)
     }
 }
 
-TimeEngine::~TimeEngine()
-{}
-
-void
-TimeEngine::tick()
-{
-    getCurrentTime();
-}
-
 std::ostream &
 operator <<(std::ostream &os, const timeval &t)
 {