summaryrefslogtreecommitdiffstats
path: root/src/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/state.rs b/src/state.rs
index dfabf8f..b8944ab 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -803,7 +803,12 @@ impl AppState {
match &result {
// One API write = one Automerge change.
Ok(_) => {
- replica.doc.commit();
+ // Stamped with our clock (milliseconds), so receivers can tell
+ // how long the change took to reach them (`swarm::stats`).
+ replica.doc.commit_with(
+ automerge::transaction::CommitOptions::default()
+ .with_time(unix_millis() as i64),
+ );
}
// Discard partial ops (e.g. old value deleted, new one not written).
Err(_) => {