Operating system time is in real date time. But let’s say I want Canton to use a different system time, eg:
System time = real date time + time offset
where, say:
real date time = 19 April 2023
time offset = -31536000 seconds
So Canton system time = 19 April 2022
Is this possible?
You can set canton.parameters.sim-clock = true
in your configuration to use a static clock, but you would have two have your own automated process to apply the desired offset.
However, it would probably be good to understand why you need this, so that maybe we can understand if there are different ways to address your problem.
1 Like
The client prefers their testing environment to use a system date that’s - year behind today’s date.
While it is straightforward to have their Java app apply this offset on any template or choice parameters of type Date or Time before it sends a command to the ledger, we also need any getTime calls in Daml or Event creation times at the ledger api server to be = now - 1 year.
-
Is using the parameter you suggested the only way? If yes, is this similar to the old sandbox’s static time concept? And so an automated process would need to keep calling setTime on the Time Service?
-
But the above setTime calls can’t be done every millisecond so how would this be done?
-
@stefanobaghino-da @oliverse Could we use this RemoteClock concept to achieve what we need? How?
Hello Mr_Mannoroth,
I just checked with our team. While RemoteClock
might yield the behavior you would like to achieve, using the SimClock
as suggested by Stefano earlier is the preferred approach. SimClock is what many of our tests are based on, and therefore using SimClock
rather than RemoteClock
is more likely to avoid pitfalls. This would of course require the SimClock to be updated at the granularity that the test environment needs.
For either approach to work, it would be essential to configure all nodes with the same clock.
1 Like