org.megam.util

Time

object Time extends TimeLikeOps[Time] with Serializable

Use Time.now in your program instead of System.currentTimeMillis, and unit tests will be able to adjust the current time to verify timeouts and other time-dependent behavior, without calling sleep.

If you import the org.megam.conversions.time implicits you can write human-readable values such as 1.minute or 250.millis.

Linear Supertypes
Serializable, Serializable, TimeLikeOps[Time], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Time
  2. Serializable
  3. Serializable
  4. TimeLikeOps
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val Bottom: Time

    Time Bottom is smaller than any other time, and is equal only to itself.

    Time Bottom is smaller than any other time, and is equal only to itself. It may be used as a sentinel value, representing a time infinitely far in the past.

    Definition Classes
    TimeTimeLikeOps
  7. object Finite

    An extractor for finite TimeLikes; eg.

  8. object Nanoseconds

    An extractor for finite This, yielding its value in nanoseconds.

  9. val Top: Time

    Time Top is greater than any other definable time, and is equal only to itself.

    Time Top is greater than any other definable time, and is equal only to itself. It may be used as a sentinel value, representing a time infinitely far into the future.

    Definition Classes
    TimeTimeLikeOps
  10. val Undefined: Time

    An undefined value: behaves like Double.

    An undefined value: behaves like Double.NaN

    Definition Classes
    TimeTimeLikeOps
  11. val Zero: Time

    The zero value

    The zero value

    Definition Classes
    TimeLikeOps
  12. def apply(date: Date): Time

  13. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  14. def at(datetime: String): Time

  15. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. val epoch: Time

    The unix epoch.

    The unix epoch. Times are measured relative to this.

  17. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def fromMicroseconds(micros: Long): Time

    Definition Classes
    TimeLikeOps
  21. def fromMilliseconds(millis: Long): Time

    Definition Classes
    TimeTimeLikeOps
  22. def fromNanoseconds(nanoseconds: Long): Time

    Make a new This from the given number of nanoseconds

    Make a new This from the given number of nanoseconds

    Definition Classes
    TimeTimeLikeOps
  23. def fromRss(rss: String): Time

    Returns the Time parsed from a string in RSS format.

    Returns the Time parsed from a string in RSS format. Eg: "Wed, 15 Jun 2005 19:00:00 GMT"

  24. def fromSeconds(seconds: Int): Time

    Definition Classes
    TimeTimeLikeOps
  25. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  26. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  29. final def notify(): Unit

    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  31. def now: Time

  32. def sleep(duration: Duration): Unit

    Puts the currently executing thread to sleep for the given duration, according to object Time.

    Puts the currently executing thread to sleep for the given duration, according to object Time.

    This is useful for testing.

  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  34. def toString(): String

    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. def withCurrentTimeFrozen[A](body: (TimeControl) ⇒ A): A

    Runs the given body at the current time.

    Runs the given body at the current time. Makes for simple, fast, predictable unit tests that are dependent on time.

    Note, this intended for use in tests.

    Since this updates shared global state, there are risks about memory visibility with multi-threaded tests.

  39. def withTimeAt[A](time: Time)(body: (TimeControl) ⇒ A): A

    Runs the given body at a specified time.

    Runs the given body at a specified time. Makes for simple, fast, predictable unit tests that are dependent on time.

    Note, this intended for use in tests.

    Since this updates shared global state, there are risks about memory visibility with multi-threaded tests.

  40. def withTimeFunction[A](timeFunction: ⇒ Time)(body: (TimeControl) ⇒ A): A

    Execute body with the time function replaced by timeFunction WARNING: This is only meant for testing purposes.

    Execute body with the time function replaced by timeFunction WARNING: This is only meant for testing purposes. You can break it with nested calls if you have an outstanding Future executing in a worker pool.

Inherited from Serializable

Inherited from Serializable

Inherited from TimeLikeOps[Time]

Inherited from AnyRef

Inherited from Any

Ungrouped