Top Description Fields Constructors Methods
com.google.common.base

public abstract Class Ticker

extends Object
Class Inheritance
Annotations
@GwtCompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible

A time source; returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time. Note that most users should use Stopwatch instead of interacting with this class directly.

Warning

this interface can only be used to measure elapsed time, not wall time.

Author
Kevin Bourrillion
Since
10.0 (mostly source-compatible since 9.0)

Field Summary

Modifier and TypeField and Description
private static final Ticker

Constructor Summary

AccessConstructor and Description
protected
Ticker()

Constructor for use by subclasses.

Method Summary

Modifier and TypeMethod and Description
public abstract long
read()

Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.

public static Ticker
systemTicker()

A ticker that reads the current time using System#nanoTime.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

SYSTEM_TICKERback to summary
private static final Ticker SYSTEM_TICKER

Constructor Detail

Tickerback to summary
protected Ticker()

Constructor for use by subclasses.

Method Detail

readback to summary
public abstract long read()

Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.

systemTickerback to summary
public static Ticker systemTicker()

A ticker that reads the current time using System#nanoTime.

Since
10.0