Package io.opencensus.common
Class TimeUtils
- java.lang.Object
-
- io.opencensus.common.TimeUtils
-
-
Field Summary
Fields Modifier and Type Field Description private static java.math.BigInteger
MAX_LONG_VALUE
(package private) static int
MAX_NANOS
(package private) static long
MAX_SECONDS
(package private) static long
MILLIS_PER_SECOND
private static java.math.BigInteger
MIN_LONG_VALUE
(package private) static long
NANOS_PER_MILLI
(package private) static long
NANOS_PER_SECOND
-
Constructor Summary
Constructors Modifier Constructor Description private
TimeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static long
checkedAdd(long x, long y)
Adds two longs and throws anArithmeticException
if the result overflows.(package private) static int
compareLongs(long x, long y)
Compares two longs.
-
-
-
Field Detail
-
MAX_SECONDS
static final long MAX_SECONDS
- See Also:
- Constant Field Values
-
MAX_NANOS
static final int MAX_NANOS
- See Also:
- Constant Field Values
-
MILLIS_PER_SECOND
static final long MILLIS_PER_SECOND
- See Also:
- Constant Field Values
-
NANOS_PER_MILLI
static final long NANOS_PER_MILLI
- See Also:
- Constant Field Values
-
NANOS_PER_SECOND
static final long NANOS_PER_SECOND
- See Also:
- Constant Field Values
-
MAX_LONG_VALUE
private static final java.math.BigInteger MAX_LONG_VALUE
-
MIN_LONG_VALUE
private static final java.math.BigInteger MIN_LONG_VALUE
-
-
Method Detail
-
compareLongs
static int compareLongs(long x, long y)
Compares two longs. This functionality is provided byLong.compare(long, long)
in Java 7.
-
checkedAdd
static long checkedAdd(long x, long y)
Adds two longs and throws anArithmeticException
if the result overflows. This functionality is provided byMath.addExact(long, long)
in Java 8.
-
-