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?
What common platforms can hold
- JavaScript
Date: whole milliseconds.performance.now()gives fractions of a millisecond, but browsers deliberately coarsen it for security. - Python
datetime: microseconds.time.time_ns()returns an integer count of nanoseconds. - PostgreSQL
timestampandtimestamptz: microseconds. - Unix time in most APIs: whole seconds, sometimes milliseconds. The number of digits tells you which, as the Unix timestamp guide explains.
What gets lost between systems
Send 2026-10-16T09:30:00.123456Z from a Python service to a browser and parse it with Date. The microseconds are gone, and the value comes back as .123Z. Two events 400 microseconds apart can now have the same timestamp, so sorting them by time no longer gives a stable order, and an equality check between the original and the round-tripped value fails. When order matters, add a sequence number or keep the full-precision value as a string.
Floating-point numbers have a limit too. A JavaScript number holds integers exactly only up to 253, about 9 × 1015. Nanoseconds since 1970 are already around 1.8 × 1018, so storing them in a plain number loses the last few digits. Use BigInt, a string, or split seconds and nanoseconds into two fields.
Digits are not accuracy
A laptop clock that syncs over the network may be tens of milliseconds off, even if its timestamps print nine decimal places. Record the precision you actually need, write it down next to the field, and use NTP or a better time source when accuracy really matters.
Common questions
Should I round or truncate extra digits?
Either can work, but choose one and use it everywhere. Truncation is common because it never moves a value into the next second or millisecond.
Is millisecond precision enough for logs?
For most application logs, yes. High-volume systems often still add a sequence number, because many events can share one millisecond.