com.r3corda.node.utilities / MutableClock

# MutableClock

`abstract class MutableClock : Clock`

An abstract class with helper methods for a type of Clock that might have its concept of "now" adjusted externally.

e.g. for testing (so unit tests do not have to wait for timeouts in realtime) or for demos and simulations.

### Constructors

<init> | `MutableClock()` An abstract class with helper methods for a type of Clock that might have its concept of "now" adjusted externally.

### Properties

mutationCount | `val mutationCount: Long` This tracks how many direct mutations of "now" have occured for this Clock, but not the passage of time.
mutations | `val mutations: <ERROR CLASS><Long>` This is an observer on the mutation count of this Clock, which reflects the occurence of mutations.

### Functions

notifyMutationObservers | `fun notifyMutationObservers(): Unit` Must be called by subclasses when they mutate (but not just with the passage of time as per the "wall clock").

### Extension Functions

awaitWithDeadline | `fun Clock.awaitWithDeadline(deadline: Instant, future: Future<*> = SettableFuture<Any>()): Boolean` Wait until the given Future is complete or the deadline is reached, with support for MutableClock implementations used in demos or testing. This will also substitute a Fiber compatible Future if required.

### Inheritors

DemoClock | `class DemoClock : MutableClock, SerializeAsToken` A Clock that can have the date advanced for use in demos.
TestClock | `class TestClock : MutableClock, SerializeAsToken` A Clock that can have the time advanced for use in testing.