Convert logcat entry time to UTC before serializing
This commit is contained in:
parent
55210a7e30
commit
2a0bffd8bb
|
@ -60,8 +60,12 @@ const char* to_string_lower(Buffer buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string to_string(const LogcatEntry& logcat_entry) {
|
std::string to_string(const LogcatEntry& logcat_entry) {
|
||||||
|
struct tm tm = logcat_entry.time;
|
||||||
|
time_t time = mktime(&tm);
|
||||||
|
gmtime_r(&time, &tm);
|
||||||
|
|
||||||
char logcat_style_time_as_str[32] = {0};
|
char logcat_style_time_as_str[32] = {0};
|
||||||
strftime(logcat_style_time_as_str, 31 * sizeof(char), "%Y-%m-%d %H:%M:%S", &logcat_entry.time);
|
strftime(logcat_style_time_as_str, 31 * sizeof(char), "%Y-%m-%d %H:%M:%S", &tm);
|
||||||
|
|
||||||
return std::string(logcat_style_time_as_str)
|
return std::string(logcat_style_time_as_str)
|
||||||
+ ' ' + leftpad(logcat_entry.user.value_or(" "), 5)
|
+ ' ' + leftpad(logcat_entry.user.value_or(" "), 5)
|
||||||
|
|
Loading…
Reference in New Issue