#include "squid.h"
#include "time/gadgets.h"
+#include <chrono>
#include <iomanip>
#include <ostream>
time_t
getCurrentTime()
{
-#if GETTIMEOFDAY_NO_TZP
- gettimeofday(¤t_time);
-#else
+ using namespace std::chrono;
+ const auto now = system_clock::now().time_since_epoch();
- gettimeofday(¤t_time, nullptr);
-#endif
+ current_time.tv_sec = duration_cast<seconds>(now).count();
+ current_time.tv_usec = duration_cast<microseconds>(now).count() % 1000000;
current_dtime = (double) current_time.tv_sec +
(double) current_time.tv_usec / 1000000.0;