Skip to content

Commit

Permalink
Remove EZTime for SB logging (#3248)
Browse files Browse the repository at this point in the history
Starboard logging will now use UTC time via gmtime_r.

b/320398326

Test-On-Device: true
(cherry picked from commit 37e0d11)
  • Loading branch information
gbournou authored and anonymous1-me committed May 15, 2024
1 parent d39c00a commit a92c5c4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
1 change: 0 additions & 1 deletion starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ group("gn_all") {
deps = [
":default",
"//starboard/client_porting/cwrappers:cwrappers_test",
"//starboard/client_porting/eztime",
"//starboard/client_porting/eztime:eztime_test",
"//starboard/client_porting/icu_init",
"//starboard/examples/glclear:starboard_glclear_example",
Expand Down
1 change: 0 additions & 1 deletion starboard/build/config/starboard_target_type.gni
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ template("starboard_platform_target") {
}
public_deps = [
"//starboard/client_porting/cwrappers",
"//starboard/client_porting/eztime",
"//starboard/common",
"//starboard/egl_and_gles",
]
Expand Down
23 changes: 11 additions & 12 deletions starboard/common/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
#include "starboard/common/log.h"

#include <pthread.h>
#include <sys/time.h>
#include <time.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <sstream>

#include "starboard/client_porting/eztime/eztime.h"
#include "starboard/common/string.h"
#include "starboard/system.h"
#include "starboard/thread.h"
Expand Down Expand Up @@ -171,17 +172,15 @@ void LogMessage::Init(const char* file, int line) {
pthread_getname_np(pthread_self(), name, SB_ARRAY_SIZE_INT(name));
stream_ << '[';
stream_ << name << '/' << pthread_self() << ':';
EzTimeValue time_value;
EzTimeValueGetNow(&time_value, NULL);
EzTimeT t = time_value.tv_sec;
struct EzTimeExploded local_time = {0};
EzTimeTExplodeLocal(&t, &local_time);
struct EzTimeExploded* tm_time = &local_time;
stream_ << std::setfill('0') << std::setw(2) << 1 + tm_time->tm_mon
<< std::setw(2) << tm_time->tm_mday << '/' << std::setw(2)
<< tm_time->tm_hour << std::setw(2) << tm_time->tm_min << std::setw(2)
<< tm_time->tm_sec << '.' << std::setw(6) << time_value.tv_usec
<< ':';
struct timeval tv;
gettimeofday(&tv, NULL);
struct tm tm_time = {0};
time_t t = static_cast<time_t>(tv.tv_sec);
gmtime_r(&t, &tm_time);
stream_ << std::setfill('0') << std::setw(2) << 1 + tm_time.tm_mon
<< std::setw(2) << tm_time.tm_mday << '/' << std::setw(2)
<< tm_time.tm_hour << std::setw(2) << tm_time.tm_min << std::setw(2)
<< tm_time.tm_sec << '.' << std::setw(6) << tv.tv_usec << "(UTC):";
stream_ << log_priority_names[priority_];
stream_ << ":" << filename << "(" << line << ")] ";
message_start_ = stream_.tellp();
Expand Down

0 comments on commit a92c5c4

Please sign in to comment.