25#ifndef __TIME_TOOLS_HPP__
26#define __TIME_TOOLS_HPP__
37 gettimeofday(&t, NULL);
41 tm* ptm = localtime(&t.tv_sec);
42 strftime(buf,
sizeof(buf), fmt.c_str(), ptm);
43 return std::string(buf);
50 gettimeofday(&t, NULL);
51 return double(t.tv_sec) + double(t.tv_usec) / 1e6;
54using time_point_t = std::chrono::high_resolution_clock::time_point;
58 return std::chrono::high_resolution_clock::now();
61inline double time_interval(std::chrono::high_resolution_clock::time_point t0)
63 return std::chrono::duration_cast<std::chrono::duration<double>>(time_now() - t0).count();
Namespace of the SIRIUS library.
auto timestamp(std::string fmt)
Return the timestamp string in a specified format.
double wtime()
Wall-clock time in seconds.