8 #include <glog/logging.h>
14 auto sec() const { return tv_
.tv_sec
; }
15 auto usec() const { return tv_
.tv_usec
; }
16 const char* c_str() const { return c_str_
; }
18 std::string_view
as_string_view() const
20 return std::string_view
{c_str(), strlen(c_str())};
25 char c_str_
[32]; // RFC 5322 date-time section 3.3.
27 friend std::ostream
& operator<<(std::ostream
& s
, Now
const& now
)
29 return s
<< now
.c_str_
;
35 PCHECK(gettimeofday(&tv_
, nullptr) == 0);
36 tm
* ptm
= CHECK_NOTNULL(localtime(&tv_
.tv_sec
));
37 CHECK_EQ(strftime(c_str_
, sizeof c_str_
, "%a, %d %b %Y %H:%M:%S %z", ptm
),