Package com.complexible.common.util.concurrent

# Class SystemClock

java.lang.Object
com.complexible.common.util.concurrent.SystemClock

All Implemented Interfaces:
  `Clock`

public class SystemClock extends Object implements Clock

Since:
  4.3
Author:
  Scott Fines

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Clock`
  `INSTANCE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `currentTimeMillis()`
  `long`
  `currentTimeNanos()`
  `long`
  `sleep(long time, TimeUnit unit)`
  Put the current thread to sleep for the time specified.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### INSTANCE

    public static final Clock INSTANCE

- ## Method Details

  - ### currentTimeMillis

    public long currentTimeMillis()
    Specified by:
      `currentTimeMillis` in interface `Clock`

  - ### currentTimeNanos

    public long currentTimeNanos()
    Specified by:
      `currentTimeNanos` in interface `Clock`

  - ### sleep

    public long sleep(long time, TimeUnit unit) throws InterruptedException
    Description copied from interface: `Clock`
    Put the current thread to sleep for the time specified. Note that this may return before the time specified has expired (i.e. the thread may wake spuriously). This is why we return how much time is remaining, in the units specified.
    Specified by:
      `sleep` in interface `Clock`
    Parameters:
      `time` - the amount of time to sleep for.
      `unit` - the unit time is measured in.
    Returns:
      the amount of time left in the wait period (i.e. time-timeSlept).
    Throws:
      `InterruptedException` - if the thread is interrupted during sleep.