Skip to content
Snippets Groups Projects
Commit e3e07779 authored by Landry Breuil's avatar Landry Breuil
Browse files

Bug 1824084: use linux codepaths for BSDs in uptime-related functions r=padenot

should unbreak telemetry for BSDs and Solaris.

In NowExcludingSuspendMs() use CLOCK_UPTIME instead of CLOCK_MONOTONIC on
OpenBSD as this one excludes time spent suspended.

Differential Revision: https://phabricator.services.mozilla.com/D173625
parent 452c46dc
No related branches found
No related tags found
No related merge requests found
......@@ -75,7 +75,7 @@ Maybe<uint64_t> NowIncludingSuspendMs() {
return Some(interrupt_time / kHNSperMS);
}
#elif defined(XP_LINUX) // including Android
#elif defined(XP_UNIX) // including BSDs and Android
# include <time.h>
// Number of nanoseconds in a millisecond.
......@@ -88,7 +88,11 @@ uint64_t TimespecToMilliseconds(struct timespec aTs) {
Maybe<uint64_t> NowExcludingSuspendMs() {
struct timespec ts = {0};
# ifdef XP_OPENBSD
if (clock_gettime(CLOCK_UPTIME, &ts)) {
# else
if (clock_gettime(CLOCK_MONOTONIC, &ts)) {
# endif
return Nothing();
}
return Some(TimespecToMilliseconds(ts));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment