Changed: Use millisecond timestamps for reports

This commit is contained in:
agnostic-apollo
2021-08-19 18:26:52 +05:00
parent 8ee0c5a6ec
commit 98edf1fbc7
3 changed files with 9 additions and 2 deletions

View File

@@ -56,7 +56,7 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
reportString.append("## Crash Details\n"); reportString.append("## Crash Details\n");
reportString.append("\n").append(MarkdownUtils.getSingleLineMarkdownStringEntry("Crash Thread", thread.toString(), "-")); reportString.append("\n").append(MarkdownUtils.getSingleLineMarkdownStringEntry("Crash Thread", thread.toString(), "-"));
reportString.append("\n").append(MarkdownUtils.getSingleLineMarkdownStringEntry("Crash Timestamp", AndroidUtils.getCurrentTimeStamp(), "-")); reportString.append("\n").append(MarkdownUtils.getSingleLineMarkdownStringEntry("Crash Timestamp", AndroidUtils.getCurrentMilliSecondUTCTimeStamp(), "-"));
reportString.append("\n\n").append(MarkdownUtils.getMultiLineMarkdownStringEntry("Crash Message", throwable.getMessage(), "-")); reportString.append("\n\n").append(MarkdownUtils.getMultiLineMarkdownStringEntry("Crash Message", throwable.getMessage(), "-"));
reportString.append("\n\n").append(Logger.getStackTracesMarkdownString("Stacktrace", Logger.getStackTracesStringArray(throwable))); reportString.append("\n\n").append(Logger.getStackTracesMarkdownString("Stacktrace", Logger.getStackTracesStringArray(throwable)));

View File

@@ -34,7 +34,7 @@ public class ReportInfo implements Serializable {
this.reportString = reportString; this.reportString = reportString;
this.reportStringSuffix = reportStringSuffix; this.reportStringSuffix = reportStringSuffix;
this.addReportInfoToMarkdown = addReportInfoToMarkdown; this.addReportInfoToMarkdown = addReportInfoToMarkdown;
this.reportTimestamp = AndroidUtils.getCurrentTimeStamp(); this.reportTimestamp = AndroidUtils.getCurrentMilliSecondUTCTimeStamp();
} }
/** /**

View File

@@ -182,6 +182,13 @@ public class AndroidUtils {
return df.format(new Date()); return df.format(new Date());
} }
public static String getCurrentMilliSecondUTCTimeStamp() {
@SuppressLint("SimpleDateFormat")
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS z");
df.setTimeZone(TimeZone.getTimeZone("UTC"));
return df.format(new Date());
}
public static String getCurrentMilliSecondLocalTimeStamp() { public static String getCurrentMilliSecondLocalTimeStamp() {
@SuppressLint("SimpleDateFormat") @SuppressLint("SimpleDateFormat")
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss.SSS"); final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss.SSS");