commit 204a38d3937e79a6182f1a7cd3780874fa6147a9
parent 31ed2996ff01f1dd7926ae4329be08ce1dc068f5
Author: Jens Stutte <jstutte@mozilla.com>
Date: Tue, 18 Nov 2025 08:13:07 +0000
Bug 1999986 - Use ToSeconds in nsExceptionHandler. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D272840
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1387,8 +1387,10 @@ static void WriteAnnotationsForMainProcessCrash(PlatformWriter& pw,
static_cast<uint64_t>(crashTime - inactiveStateStart));
}
- double uptimeTS = (TimeStamp::NowLoRes() - TimeStamp::ProcessCreation())
- .ToSecondsSigDigits();
+ // ToSeconds preserves the full precision of the TimeDuration. It is assumed
+ // that visualizations of this value will format/truncate it to their needs.
+ double uptimeTS =
+ (TimeStamp::NowLoRes() - TimeStamp::ProcessCreation()).ToSeconds();
char uptimeTSString[64] = {};
SimpleNoCLibDtoA(uptimeTS, uptimeTSString, sizeof(uptimeTSString));
writer.Write(Annotation::UptimeTS, uptimeTSString);
@@ -2557,8 +2559,10 @@ static void AddCommonAnnotations(AnnotationTable& aAnnotations) {
aAnnotations[Annotation::LastInteractionDuration] = inactiveDuration;
}
- double uptimeTS = (TimeStamp::NowLoRes() - TimeStamp::ProcessCreation())
- .ToSecondsSigDigits();
+ // ToSeconds preserves the full precision of the TimeDuration. It is assumed
+ // that visualizations of this value will format/truncate it to their needs.
+ double uptimeTS =
+ (TimeStamp::NowLoRes() - TimeStamp::ProcessCreation()).ToSeconds();
nsAutoCString uptimeStr;
uptimeStr.AppendFloat(uptimeTS);
aAnnotations[Annotation::UptimeTS] = uptimeStr;