Fix clang-tidy warnings in log_time.h
- Zero initialize log_time instances by default
- Disable implicit conversions by making constructors explicit
- Explicitly initialize to EPOCH in most places
- Change sniffTime() to avoid in-place modification of a log_time
I stopped here, but we could consider following up with a more invasive
change to make log_time instances immutable and perhaps also remove the
default constructor to force explicit initialization to EPOCH.
Test: atest libbase_test netd_unit_test
Change-Id: I67e716ef74adaaf40ab2c6e2e0dddb8d309bc7ca
diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp
index 18d5287..470ffed 100644
--- a/logd/LogAudit.cpp
+++ b/logd/LogAudit.cpp
@@ -300,7 +300,7 @@
return 0;
}
- log_time now;
+ log_time now(log_time::EPOCH);
static const char audit_str[] = " audit(";
char* timeptr = strstr(str, audit_str);