Deadline

case class Deadline extends Ordered[Deadline]

This class stores a deadline, as obtained via Deadline.now or the duration DSL:

This class stores a deadline, as obtained via Deadline.now or the duration DSL:

import scala.concurrent.duration._
3.seconds.fromNow

Its main purpose is to manage repeated attempts to achieve something (like awaiting a condition) by offering the methods hasTimeLeft and timeLeft. All durations are measured according to System.nanoTime; this does not take into account changes to the system clock (such as leap seconds).

Companion
object
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def +(other: FiniteDuration): Deadline

Return a deadline advanced (i.e., moved into the future) by the given duration.

Return a deadline advanced (i.e., moved into the future) by the given duration.

def -(other: FiniteDuration): Deadline

Return a deadline moved backwards (i.e., towards the past) by the given duration.

Return a deadline moved backwards (i.e., towards the past) by the given duration.

def -(other: Deadline): FiniteDuration

Calculate time difference between this and the other deadline, where the result is directed (i.e., may be negative).

Calculate time difference between this and the other deadline, where the result is directed (i.e., may be negative).

def compare(other: Deadline): Int

The natural ordering for deadline is determined by the natural order of the underlying (finite) duration.

The natural ordering for deadline is determined by the natural order of the underlying (finite) duration.

Determine whether the deadline still lies in the future at the point where this method is called.

Determine whether the deadline still lies in the future at the point where this method is called.

Note that on some systems this operation is costly because it entails a system call. Check System.nanoTime for your platform.

Determine whether the deadline lies in the past at the point where this method is called.

Determine whether the deadline lies in the past at the point where this method is called.

Note that on some systems this operation is costly because it entails a system call. Check System.nanoTime for your platform.

Calculate time difference between this duration and now; the result is negative if the deadline has passed.

Calculate time difference between this duration and now; the result is negative if the deadline has passed.

Note that on some systems this operation is costly because it entails a system call. Check System.nanoTime for your platform.

Inherited methods

def <(that: Deadline): Boolean

Returns true if this is less than that

Returns true if this is less than that

Inherited from
Ordered
def <=(that: Deadline): Boolean

Returns true if this is less than or equal to that.

Returns true if this is less than or equal to that.

Inherited from
Ordered
def >(that: Deadline): Boolean

Returns true if this is greater than that.

Returns true if this is greater than that.

Inherited from
Ordered
def >=(that: Deadline): Boolean

Returns true if this is greater than or equal to that.

Returns true if this is greater than or equal to that.

Inherited from
Ordered
def compareTo(that: Deadline): Int

Result of comparing this with operand that.

Result of comparing this with operand that.

Inherited from
Ordered

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Inherited from
Product

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Returns

in the default implementation, an Iterator[Any]

Inherited from
Product