public class

RealtimeSinceBootClock

extends Object
implements MonotonicClock
java.lang.Object
   ↳ com.facebook.common.time.RealtimeSinceBootClock

Class Overview

A clock that returns number of milliseconds since boot. It guarantees that every next call to now() will return a value that is not less that was returned from previous call to now(). This happens regardless system time changes, time zone changes, daylight saving changes etc.

NOTE: For performance logging, consider using AwakeTimeSinceBootClock since it stops ticking while the device sleeps.

Summary

Public Methods
static RealtimeSinceBootClock get()
Returns a singleton instance of this clock.
long now()
Produce a timestamp.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.facebook.common.time.MonotonicClock

Public Methods

public static RealtimeSinceBootClock get ()

Returns a singleton instance of this clock.

Returns
  • singleton instance

public long now ()

Produce a timestamp. Values returned from this method may only be compared to other values returned from this clock in this process. They have no meaning outside of this process and should not be written to disk.

The difference between two timestamps is an interval, in milliseconds.

Returns
  • A timestamp for the current time, in ms.