Ticks

class Ticks 

A value type for tracking elapsed time without committing to specific epoch baseline value or relationship to physical seconds, specifically SI seconds.

The value held by a Ticks is a reading from a Ticker , and can be converted to and from a value in seconds. The seconds values calculated may be inaccurate depending on the accuracy and precision of the underlying ticker .

Each object holds a reference to an originTicker which is intended to prevent comparisons between, and calculations using ticks originating from different tickers .

Summary

Public functions

Duration !
@ RequiresApi (api = VERSION_CODES.O)
durationUntil (other:  Ticks !)

Calculates the Duration between this ticks and another ticks.

Boolean
equals (o:  Any ?)
Long ?

Calculates the absolute error estimate between this ticks and another ticks in milliseconds, or null if the error cannot be computed.

Ticker !

Returns the Ticker that this ticks originated from.

Int
Boolean
isAfter (t1:  Ticks !)

Returns true if this ticks was generated after the specified ticks.

Boolean
isBefore (t1:  Ticks !)

Returns true if this ticks was generated before the specified ticks.

Long
millisUntil (other:  Ticks !)

Returns the duration in milliseconds between this ticks and another ticks.

String !

Public functions

durationUntil

@ RequiresApi 
(api = VERSION_CODES.O)
fun  durationUntil (other:  Ticks !):  Duration !

Calculates the Duration between this ticks and another ticks.

The accuracy and precision of the Duration will depend on the accuracy and precision of the origin Ticker . If the origin Ticker has low accuracy, the resulting Duration will be inaccurate. If the ticks do not originate from the same ticker, then an IllegalArgumentException is thrown.

Parameters
other:  Ticks !

the other ticks, not null

Returns
Duration !

a non null Duration that is the period of time between the two ticks. If this was read after the specified ticks then the return value will be a negative period else it is positive.

Throws
java.lang.IllegalArgumentException

if the ticks do not originate from the same ticker

java.lang.ArithmeticException

if the calculation results in an overflow

equals

fun  equals 
(o:  Any 
?):  Boolean 

estimatedErrorMillisUntil

fun  estimatedErrorMillisUntil 
(other:  Ticks 
!):  Long 
?

Calculates the absolute error estimate between this ticks and another ticks in milliseconds, or null if the error cannot be computed.

This value can be null if the behavior of the local device clock used to track ticks is not yet known, or has been detected to be unpredictable.

Parameters
other:  Ticks !

the other ticks, not null

Throws
java.lang.IllegalArgumentException

if the ticks does not originate from the same ticker

java.lang.ArithmeticException

if the calculation results in an overflow

getOriginTicker

fun  getOriginTicker 
():  Ticker 
!

Returns the Ticker that this ticks originated from.

hashCode

fun  hashCode 
():  Int 

isAfter

fun  isAfter 
(t1:  Ticks 
!):  Boolean 

Returns true if this ticks was generated after the specified ticks. The determination of ordering is dependent on the precision of the origin ticker.

Parameters
t1:  Ticks !

the ticks to compare to

Throws
java.lang.IllegalArgumentException

if the ticks do not originate from the same ticker

isBefore

fun  isBefore 
(t1:  Ticks 
!):  Boolean 

Returns true if this ticks was generated before the specified ticks. The determination of ordering is dependent on the precision of the origin ticker.

Parameters
t1:  Ticks !

the ticks to compare to

Throws
java.lang.IllegalArgumentException

if the ticks do not originate from the same ticker

millisUntil

fun  millisUntil 
(other:  Ticks 
!):  Long 

Returns the duration in milliseconds between this ticks and another ticks.

The accuracy and precision of the duration will depend on the accuracy and precision of the origin Ticker . If the origin Ticker has low accuracy, the resulting duration will be inaccurate. If the ticks do not originate from the same ticker, then an IllegalArgumentException is thrown.

Parameters
other:  Ticks !

the end ticks, not null

Returns
Long

a long that is the period of time between the two ticks in milliseconds. If this was read after the specified ticks then the return value will be a negative period else it is positive.

Throws
java.lang.IllegalArgumentException

if the ticks do not originate from the same ticker

java.lang.ArithmeticException

if the calculation results in an overflow

toString

fun  toString 
():  String 
!
Create a Mobile Website
View Site in Mobile | Classic
Share by: