VirtualClock (interface)

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)
  long nowAsEpochMilli()     (13)
  LocalDate nowAsLocalDate(ZoneId zoneId)     (14)
  LocalDate nowAsLocalDate()     (15)
  LocalDateTime nowAsLocalDateTime(ZoneId zoneId)     (16)
  LocalDateTime nowAsLocalDateTime()     (17)
  OffsetDateTime nowAsOffsetDateTime(ZoneId zoneId)     (18)
  OffsetDateTime nowAsOffsetDateTime()     (19)
  java.util.Date nowAsJavaUtilDate()     (20)
  java.sql.Timestamp nowAsJavaSqlTimestamp()     (21)
  XMLGregorianCalendar nowAsXmlGregorianCalendar()     (22)
  org.joda.time.DateTime nowAsJodaDateTime(ZoneId zoneId)     (23)
  org.joda.time.DateTime nowAsJodaDateTime()     (24)
  org.joda.time.LocalDateTime nowAsJodaLocalDateTime(ZoneId zoneId)     (25)
  org.joda.time.LocalDateTime nowAsJodaLocalDateTime()     (26)
  org.joda.time.LocalDate nowAsJodaLocalDate(ZoneId zoneId)     (27)
  org.joda.time.LocalDate nowAsJodaLocalDate()     (28)
}
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 nowAsEpochMilli()

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

14 nowAsLocalDate(ZoneId)

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

15 nowAsLocalDate()

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

16 nowAsLocalDateTime(ZoneId)

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

17 nowAsLocalDateTime()

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

18 nowAsOffsetDateTime(ZoneId)

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

19 nowAsOffsetDateTime()

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

20 nowAsJavaUtilDate()

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

21 nowAsJavaSqlTimestamp()

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

22 nowAsXmlGregorianCalendar()

Returns the (virtual) time as XMLGregorianCalendar .

23 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.

24 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.

25 nowAsJodaLocalDateTime(ZoneId)

deprecated:

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

26 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.

27 nowAsJodaLocalDate(ZoneId)

deprecated:

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

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

28 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)

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.