Closed Bug 1349775 Opened 7 years ago Closed 7 years ago

TimeStamp::ProcessCreation has annoying required bool& outparam

Categories

(Toolkit :: Startup and Profile System, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1358320

People

(Reporter: sfink, Unassigned)

Details

A very very common desire is to get a TimeDuration representing the time since process creation. (Or since any fixed point in time, but that's as good as we have.)

  double t = (TimeStamp::Now() - TimeStamp::ProcessCreation()).ToMilliseconds();

wouldn't be too bad, except that ProcessCreation requires you to pass in a bool outparam to check whether the creation time is "inconsistent".

Which is an important thing to know, but none of the users can do anything about it, and the only one that cares is the telemetry probe that reports on it. If you search the tree, every other caller is using a junk bool like 'ignore'. Why fight it? Make it a separate accessor or an optional ProcessCreation(bool* isInconsistent = nullptr) or something.

Alternatively, all of my uses could be satisfied by

  TimeDuration DurationSinceProcessCreation();

API. Most uses in the tree could probably go through this too, but sometimes there's a better 'now' value lying around, and sometimes the caller wants NowLoRes for performance. And I wasn't sure where to put it -- on BaseTimeDuration, but then it couldn't return a TimeDuration? Or on TimeStamp, which seems a little weird? It is perhaps not general enough.
Summary: TimeStamp::ProcessCreation is annoying to use → TimeStamp::ProcessCreation has annoying required bool& outparam
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.