18 std::unique_ptr<const timestampert>
23 return std::unique_ptr<const timestampert>(
new timestampert());
28 return std::unique_ptr<const timestampert>(
new timestampert());
30 return std::unique_ptr<const monotonic_timestampert>(
33 return std::unique_ptr<const wall_clock_timestampert>(
43 std::chrono::time_point<std::chrono::steady_clock, std::chrono::microseconds>
44 time_stamp = std::chrono::time_point_cast<std::chrono::microseconds>(
45 std::chrono::steady_clock::now());
47 auto cnt = time_stamp.time_since_epoch().count();
48 std::lldiv_t divmod = lldiv(cnt, 1000000);
51 ss << divmod.quot <<
"." << std::setfill(
'0') << std::setw(6) << divmod.rem;
55 #define WALL_FORMAT "%Y-%m-%dT%H:%M:%S."
59 std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>
60 time_stamp = std::chrono::time_point_cast<std::chrono::microseconds>(
61 std::chrono::system_clock::now());
63 unsigned u_seconds = time_stamp.time_since_epoch().count() % 1000000;
65 std::time_t tt = std::chrono::system_clock::to_time_t(time_stamp);
69 ss << std::put_time(&local,
WALL_FORMAT) << std::setfill(
'0') << std::setw(6)
virtual std::string stamp() const override
See HELP_TIMESTAMP in util/timestamper.h for time stamp format.
Timestamp class hierarchy.
clockt
Derived types of timestampert.
@ MONOTONIC
monotonic_timestampert
@ WALL_CLOCK
wall_clock_timestampert
static std::unique_ptr< const timestampert > make(clockt clock_type)
Factory method to build timestampert subclasses.
virtual std::string stamp() const override
See HELP_TIMESTAMP in util/timestamper.h for time stamp format.
#define UNREACHABLE
This should be used to mark dead code.
struct tm * localtime(const time_t *clock)