VirtualClock

Works in connection with InteractionService , such that it allows an Interaction to run with its own simulated (or actual) time.

API

VirtualClock.java
interface VirtualClock {
  Instant nowAsInstant()     (1)
  VirtualClock system()     (2)
  VirtualClock nowAt(Instant virtualNow)     (3)
  VirtualClock nowAt(java.time.LocalDate virtualNow)     (4)
  VirtualClock nowAt(java.time.LocalDateTime virtualNow)
  VirtualClock nowAt(java.time.OffsetDateTime virtualNow)
  VirtualClock nowAt(java.time.ZonedDateTime virtualNow)
  VirtualClock nowAt(java.util.Date virtualNow)
  VirtualClock nowAt(org.joda.time.LocalDate virtualNow)     (5)
  VirtualClock nowAt(org.joda.time.LocalDateTime virtualNow)     (6)
  VirtualClock nowAt(org.joda.time.DateTime virtualNow)     (7)
  VirtualClock frozenAt(Instant frozenAt)     (8)
  VirtualClock frozenAt(java.time.LocalDate frozenAt)
  VirtualClock frozenAt(java.time.LocalDateTime frozenAt)
  VirtualClock frozenAt(java.time.OffsetDateTime frozenAt)
  VirtualClock frozenAt(java.time.ZonedDateTime frozenAt)
  VirtualClock frozenAt(java.util.Date frozenAt)
  VirtualClock frozenAt(org.joda.time.LocalDate frozenAt)     (9)
  VirtualClock frozenAt(org.joda.time.LocalDateTime frozenAt)     (10)
  VirtualClock frozenAt(org.joda.time.DateTime frozenAt)     (11)
  VirtualClock frozenTestClock()     (12)
  ZoneId localTimeZone()     (13)
  long nowAsEpochMilli()     (14)
  LocalDate nowAsLocalDate(ZoneId zoneId)     (15)
  LocalDate nowAsLocalDate()     (16)
  LocalDateTime nowAsLocalDateTime(ZoneId zoneId)     (17)
  LocalDateTime nowAsLocalDateTime()     (18)
  OffsetDateTime nowAsOffsetDateTime(ZoneId zoneId)     (19)
  OffsetDateTime nowAsOffsetDateTime()     (20)
  java.util.Date nowAsJavaUtilDate()     (21)
  java.sql.Timestamp nowAsJavaSqlTimestamp()     (22)
  XMLGregorianCalendar nowAsXmlGregorianCalendar()     (23)
  org.joda.time.DateTime nowAsJodaDateTime(ZoneId zoneId)     (24)
  org.joda.time.DateTime nowAsJodaDateTime()     (25)
  org.joda.time.LocalDateTime nowAsJodaLocalDateTime(ZoneId zoneId)     (26)
  org.joda.time.LocalDateTime nowAsJodaLocalDateTime()     (27)
  org.joda.time.LocalDate nowAsJodaLocalDate(ZoneId zoneId)     (28)
  org.joda.time.LocalDate nowAsJodaLocalDate()     (29)
}
1 nowAsInstant()

Returns the (virtual) time as an Instant .

2 system()

Returns the system’s default ticking clock.

3 nowAt(Instant)

Returns a ticking clock set to virtual time Instant virtualNow

4 nowAt(java_time_LocalDate)

Returns a ticking clock set to virtual time.

5 nowAt(org_joda_time_LocalDate)

deprecated:

convert use java.time variant instead (Joda Time is deprecated)

6 nowAt(org_joda_time_LocalDateTime)

deprecated:

convert use java.time variant instead (Joda Time is deprecated)

7 nowAt(org_joda_time_DateTime)

deprecated:

convert use java.time variant instead (Joda Time is deprecated)

8 frozenAt(Instant)

Always returns the time Instant as given by frozenAt

9 frozenAt(org_joda_time_LocalDate)

deprecated:

use java.time variant instead (Joda Time is deprecated)

10 frozenAt(org_joda_time_LocalDateTime)

deprecated:

use java.time variant instead (Joda Time is deprecated)

11 frozenAt(org_joda_time_DateTime)

deprecated:

use java.time variant instead (Joda Time is deprecated)

12 frozenTestClock()

Always returns the time Instant 2003/8/17 21:30:25 (UTC)

13 localTimeZone()

Used to interpret local time.

14 nowAsEpochMilli()

Returns the (virtual) time as the number of milliseconds since the epoch start.

15 nowAsLocalDate(ZoneId)

Returns the (virtual) time as LocalDate , using the ZoneId timezone.

16 nowAsLocalDate()

Returns the (virtual) time as LocalDate , using the ZoneId#systemDefault() system default timezone.

17 nowAsLocalDateTime(ZoneId)

Returns the (virtual) time as LocalDateTime , using the ZoneId timezone.

18 nowAsLocalDateTime()

Returns the (virtual) time as LocalDateTime , using the ZoneId#systemDefault() system default timezone.

19 nowAsOffsetDateTime(ZoneId)

Returns the (virtual) time as OffsetDateTime , using the ZoneId timezone.

20 nowAsOffsetDateTime()

Returns the (virtual) time as OffsetDateTime , using the ZoneId#systemDefault() system default timezone.

21 nowAsJavaUtilDate()

Returns the (virtual)time as java.util.Date .

22 nowAsJavaSqlTimestamp()

Returns the (virtual) time as java.sql.Timestamp .

23 nowAsXmlGregorianCalendar()

Returns the (virtual) time as XMLGregorianCalendar .

24 nowAsJodaDateTime(ZoneId)

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda org.joda.time.DateTime , using the specified ZoneId timezone.

25 nowAsJodaDateTime()

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda org.joda.time.DateTime , using the ZoneId#systemDefault() system default timezone.

26 nowAsJodaLocalDateTime(ZoneId)

deprecated:

use java.time variant instead (Joda Time is deprecated)

27 nowAsJodaLocalDateTime()

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda org.joda.time.LocalDateTime , using the ZoneId#systemDefault() system default timezone.

28 nowAsJodaLocalDate(ZoneId)

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda DateTime , using the specified ZoneId timezone.

29 nowAsJodaLocalDate()

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda DateTime , using the ZoneId#systemDefault() system default timezone.

Members

nowAsInstant()

Returns the (virtual) time as an Instant .

system()

Returns the system’s default ticking clock.

nowAt(Instant)

Returns a ticking clock set to virtual time Instant virtualNow

nowAt(java_time_LocalDate)

Returns a ticking clock set to virtual time.

nowAt(org_joda_time_LocalDate)

deprecated:

convert use java.time variant instead (Joda Time is deprecated)

nowAt(org_joda_time_LocalDateTime)

deprecated:

convert use java.time variant instead (Joda Time is deprecated)

nowAt(org_joda_time_DateTime)

deprecated:

convert use java.time variant instead (Joda Time is deprecated)

frozenAt(Instant)

Always returns the time Instant as given by frozenAt

frozenAt(org_joda_time_LocalDate)

deprecated:

use java.time variant instead (Joda Time is deprecated)

frozenAt(org_joda_time_LocalDateTime)

deprecated:

use java.time variant instead (Joda Time is deprecated)

frozenAt(org_joda_time_DateTime)

deprecated:

use java.time variant instead (Joda Time is deprecated)

frozenTestClock()

Always returns the time Instant 2003/8/17 21:30:25 (UTC)

localTimeZone()

Used to interpret local time.

Returns ZoneId#systemDefault() .

nowAsEpochMilli()

Returns the (virtual) time as the number of milliseconds since the epoch start.

nowAsLocalDate(ZoneId)

Returns the (virtual) time as LocalDate , using the ZoneId timezone.

nowAsLocalDate()

Returns the (virtual) time as LocalDate , using the ZoneId#systemDefault() system default timezone.

nowAsLocalDateTime(ZoneId)

Returns the (virtual) time as LocalDateTime , using the ZoneId timezone.

nowAsLocalDateTime()

Returns the (virtual) time as LocalDateTime , using the ZoneId#systemDefault() system default timezone.

nowAsOffsetDateTime(ZoneId)

Returns the (virtual) time as OffsetDateTime , using the ZoneId timezone.

nowAsOffsetDateTime()

Returns the (virtual) time as OffsetDateTime , using the ZoneId#systemDefault() system default timezone.

nowAsJavaUtilDate()

Returns the (virtual)time as java.util.Date .

nowAsJavaSqlTimestamp()

Returns the (virtual) time as java.sql.Timestamp .

nowAsXmlGregorianCalendar()

Returns the (virtual) time as XMLGregorianCalendar .

nowAsJodaDateTime(ZoneId)

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda org.joda.time.DateTime , using the specified ZoneId timezone.

nowAsJodaDateTime()

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda org.joda.time.DateTime , using the ZoneId#systemDefault() system default timezone.

nowAsJodaLocalDateTime(ZoneId)

deprecated:

use java.time variant instead (Joda Time is deprecated)

nowAsJodaLocalDateTime()

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda org.joda.time.LocalDateTime , using the ZoneId#systemDefault() system default timezone.

nowAsJodaLocalDate(ZoneId)

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda DateTime , using the specified ZoneId timezone.

nowAsJodaLocalDate()

deprecated:

use java.time variant instead (Joda Time is deprecated)

Returns the time as a Joda DateTime , using the ZoneId#systemDefault() system default timezone.