I'm building a personal media tracker with clients on Linux and Android, plus an always-online server that acts as a backup and synchronization point. Each client should work offline and sync whenever a connection becomes available.
My current design stores an edit timestamp for every field, along with a version number for each record and another version for the database. During synchronization, each device would send records with newer versions, then compare incoming field timestamps with its own and keep the most recent value.
However, I'm concerned that device clocks can drift or be temporarily incorrect. Is relying on epoch timestamps safe for resolving conflicts in a personal application, or should I use logical clocks, operation logs, or another approach?
3 Answers
For a personal tracker, clock drift may be small most of the time because phones and computers regularly synchronize their clocks, but wall-clock time still isn’t guaranteed to be correct. A clock can be off by seconds or minutes, especially when a device has been offline, so timestamps alone can incorrectly decide which edit wins.
A safer approach is to give every device its own ID and track a local counter for each change. Exchange changes using those counters, and use the device ID only as a deterministic tie-breaker when two edits are otherwise incomparable. That way every device reaches the same result without trusting its system clock.
Content hashes can help determine whether two records or media files are actually identical, but they don’t establish which conflicting edit happened later. They’re useful alongside synchronization metadata, not as a replacement for it.
For a more advanced design, look into logical clocks, hybrid logical clocks, or CRDTs. They’re designed for this kind of offline, multi-device conflict resolution, although a per-device operation log is probably simpler and more than sufficient for a personal media tracker.
An append-only operation log is a good fit here. Each device records operations such as “set rating” or “mark as watched” and numbers its own operations 1, 2, 3, and so on. During synchronization, devices exchange operations the other side hasn’t seen, then apply them according to your conflict rules.
This works offline and avoids repeatedly comparing complete database snapshots. You’ll still need to decide what happens when two devices edit the same field, but that rule can be deterministic—for example, choose the operation with the higher logical counter and use the device ID to break ties.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically