core / TransactionBuilder / setTime

setTime

fun setTime(time: Instant, authenticatedBy: Party, timeTolerance: Duration): Unit

Places a TimestampCommand in this transaction, removing any existing command if there is one. To get the right signature from the timestamping service, use the timestamp method after building is finished, or run use the TimestampingProtocol yourself.

The window of time in which the final timestamp may lie is defined as time +/- timeTolerance. If you want a non-symmetrical time window you must add the command via addCommand yourself. The tolerance should be chosen such that your code can finish building the transaction and sending it to the TSA within that window of time, taking into account factors such as network latency. Transactions being built by a group of collaborating parties may therefore require a higher time tolerance than a transaction being built by a single node.