I am trying to execute 2 choices one after the another. Both are executing so fast, that they have same timestamp.
timestamp = 1607079031453, Thus making it difficult to arrange via ascending order in a table.
Canyou suggest any work aroud for this?
getTime
in DAML does not give you "system time", as there is no notion of system time on a distributed system. It gives you something called "Ledger Time" documented here: https://docs.daml.com/concepts/time.htmlLedger Time is specified by the submitting node, and a property of the entire transaction. That means all calls to
getTime
within a single transaction will return the same time.If you create two identical contracts in a single transaction, there are only two ways to distinguish them:
Contract Id is a hash so gives you no useful ordering properties other than some value to order by stably. If you want to order by the order in which contracts were created, you need to use the position in the transaction tree.
I don't know where you store your data, or which API you use to store it there, but suppose you used a subscription to the Transaction Service, which returns
Create
events in order, and stored it to an SQL database, you can just put an auto-incrementing integer column on your table and use that integer to sort by.