MCPcopy Create free account
hub / github.com/chromium/crashpad / TimeToString

Function TimeToString

tools/crashpad_database_util.cc:205–223  ·  view source on GitHub ↗

Converts |out_time| to a string, and returns it. |utc| determines whether the converted time will reference local time or UTC. If |out_time| is 0, the string "never" will be returned as a special case.

Source from the content-addressed store, hash-verified

203// converted time will reference local time or UTC. If |out_time| is 0, the
204// string "never" will be returned as a special case.
205std::string TimeToString(time_t out_time, bool utc) {
206 if (out_time == 0) {
207 return std::string("never");
208 }
209
210 tm time_tm;
211 if (utc) {
212 PCHECK(gmtime_r(&out_time, &time_tm));
213 } else {
214 PCHECK(localtime_r(&out_time, &time_tm));
215 }
216
217 char string[64];
218 CHECK_NE(
219 strftime(string, std::size(string), "%Y-%m-%d %H:%M:%S %Z", &time_tm),
220 0u);
221
222 return std::string(string);
223}
224
225// Shows information about a single |report|. |space_count| is the number of
226// spaces to print before each line that is printed. |utc| determines whether

Callers 2

ShowReportFunction · 0.85
DatabaseUtilMainFunction · 0.85

Calls 2

gmtime_rFunction · 0.85
localtime_rFunction · 0.85

Tested by

no test coverage detected