Interface AdjustedClock

com.yandex.mapkit.transport.time

public interface AdjustedClock

Methods

boolean isValid()

Tells if this AdjustedClock is valid or no.

long now()

This method returns the time that has been synchronized with Yandex servers.

void pause()

Notifies AdjustedClock when the application pauses and goes to the background.

void resume()

Notifies AdjustedClock when the application resumes the foreground state.

Method Detail

isValid

public boolean isValid ()

Tells if this AdjustedClock is valid or no.

Any other method (except for this one) called on an invalid AdjustedClock will throw java.lang.RuntimeException. An instance becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.

now

public long now ()

This method returns the time that has been synchronized with Yandex servers.

Use it if you don't trust the time on the local device because the user could have set it incorrectly. If time synchronization has failed or not yet finished, the returned value equals the local device's time.

Returns:

POSIX time. For more information, see https://en.wikipedia.org/wiki/Unix_time.

pause

public void pause ()

Notifies AdjustedClock when the application pauses and goes to the background.

resume

public void resume ()

Notifies AdjustedClock when the application resumes the foreground state.