Skip to content
  • Mike Conley's avatar
    Bug 1614861 - Make slow startup notification bar sampler use monotonic clock. r=gsvelto · a135d651
    Mike Conley authored
    The slow startup notification bar sampler code was using
    `Date.now() - Services.startup.getStartupInfo().process`.
    
    `Services.startup.getStartupInfo().process` is a high-resolution timestamp from a
    monotonic clock that has been converted to a Date object. Date.now() is a timestamp
    from a clock that is _not guaranteed to be monotonic_, so even though they're technically
    the same type, Date.now() ultimately has looser guarantees on its stability.
    
    Date.now() can, for example, change if the OS communicates with a clock on a network,
    and updates itself - this can move the clock forward or backward. Timezone changes can
    also impact Date.now(). These are edge-cases, but users do hit them nonetheless.
    
    This patch switches the sampler to use `Cu.now()`, which is a high-resolution interval
    from process start to the current time using a monotonic clock.
    
    Differential Revision: https://phabricator.services.mozilla.com/D62760
    
    --HG--
    extra : moz-landing-system : lando
    a135d651