What Is Timestamp Precision?
Timestamp precision describes the smallest unit a value can express. It is related to, but not the same as, how accurately a clock knows the time.
Precision, resolution and accuracy
Consider a timestamp written as 2026-10-16T09:30:00.123456Z. The six digits after the decimal point express microsecond-level precision in the representation. A timestamp ending at whole seconds has lower represented precision. Resolution is often used for the smallest increment a clock or system can report.
Accuracy asks a different question: how close is the clock reading to the correct reference time? A clock can report many decimal places and still be several seconds wrong. Extra digits may be useful for ordering events produced by one system, but they do not prove that the system was synchronized or measured at that accuracy.
Where timestamp precision comes from
Precision is constrained by several parts of a system: the clock hardware, operating system, programming language, database column and API format. One component may store milliseconds, while another accepts microseconds. A conversion can truncate or round the value as it moves through the system.
For example, JavaScript's common date object represents time in milliseconds. If a service sends a timestamp with six fractional digits, converting it through a millisecond-based type may discard the final three digits. Similarly, a database column configured for only seconds cannot preserve finer fractional values.
Precision can affect ordering
Suppose two events happen very close together. If both are rounded to the same millisecond or second, their timestamps may appear equal. This does not necessarily mean they happened simultaneously. Applications can use a sequence number, monotonic clock or database ordering in addition to wall-clock timestamps when exact ordering matters.
Distributed systems add another complication: different machines can have clocks that are slightly out of sync. A later real event from one machine may carry an earlier wall-clock timestamp than an event from another. Higher numerical precision alone does not solve clock synchronization or establish causal order.
Choose precision for the task
Human schedules normally need minutes, not nanoseconds. Logs may benefit from milliseconds or finer precision for diagnostics. Scientific measurements may need both a documented time scale and measurement uncertainty. Choose a format and storage type that match the requirement, and document what the digits mean.
When comparing two timestamps, first normalize their units and time scales. Do not compare seconds to milliseconds as raw numbers. For clock synchronization, see What Is Network Time Protocol?, and for the value's origin, see What Is the Unix Epoch?
Choosing a precision for storage
Pick a unit that matches how the value will be used, not the finest unit a library can print:
- Whole seconds are often enough for logs, cache expiry and many APIs.
- Milliseconds are common in browsers and some databases because JavaScript's
Dateuses them. - Microseconds or nanoseconds appear in high-frequency telemetry, but only help if the clock source and transport preserve that resolution.
Writing more digits than the clock can justify creates a false sense of accuracy. A laptop that synchronizes over the network may be wrong by tens of milliseconds even if a library shows nanoseconds. Document the expected precision beside the field so later readers do not treat display formatting as measurement quality. Related reading: Unix timestamps and Network Time Protocol.