Programmatically setting the time

I see Can I imitate the passing of time with REPL? which seems related.

We have a demostration application where on the frontend we’d like to allow users to spoof a different current date. The idea being that this allows them to verify certain flows work without having to wait for the real time to elapse. Is such a thing possible? Or does one have to restart daml using the CLI flags described in that thread?

3 Likes

Hi @Ericson2314 , welcome to the Daml forums.

If you are running a development ledger (ie the Sandbox) in static time mode, you can use the TimeService to set the time. Daml REPL and Script go through the Ledger API so anything you can do there, you can do from your own client application, too. Just. a matter of finding the right service :wink:

Ed.: To start the Sandbox in static time mode use the --static-time CLI flag or add this to your daml.yaml:

sandbox-options:
  - --static-time
2 Likes

Thanks!

1 Like