Unify logging timestamp string.

Bug: 275278933
Fix: 275278933
Test: presubmit
Change-Id: Ifc67b9bf841f018465ee4a7b38b3a8605f60212b
This commit is contained in:
Zaiyue Xue
2023-03-27 14:45:16 +08:00
parent 89c6471454
commit 9723490f63
8 changed files with 25 additions and 62 deletions

View File

@@ -237,9 +237,10 @@ public final class ConvertUtils {
return eventBuilder.build();
}
/** Converts UTC timestamp to human readable local time string. */
public static String utcToLocalTime(Context context, long timestamp) {
final Locale locale = getLocale(context);
/** Converts UTC timestamp to local time string for logging only, so use the US locale for
* better readability in debugging. */
public static String utcToLocalTimeForLogging(long timestamp) {
final Locale locale = Locale.US;
final String pattern =
DateFormat.getBestDateTimePattern(locale, "MMM dd,yyyy HH:mm:ss");
return DateFormat.format(pattern, timestamp).toString();