Back to Blog
Smart Factory

When Every Machine Keeps Its Own Time, Your Data Lies: Factory Time Synchronization (NTP/PTP) and Timestamp Design

When PLCs, HMIs, and MES servers keep different time, root-cause analysis, traceability, and cycle-time calculations all go wrong. This guide covers recording event and collection times separately, choosing between NTP and PTP, and correcting legacy equipment.

POLYGLOTSOFT Tech Team2026-11-097 min read14
Time SynchronizationNTPPTPEquipment DataMES

The Factory Where the Alarm Comes Before the Cause

Look through a plant's fault history and you'll sometimes find effects recorded before their causes. A "conveyor stopped" alarm might show 10:02:15, while the "inverter overcurrent" that caused it shows 10:02:48. Nothing happened out of order. The PLC and the MES server were just 33 seconds apart.

When PLCs, HMIs, machine PCs, and MES servers each run their own clocks, you get problems like these:

  • Wrong root-cause analysis: events show up in reverse order, so an effect gets blamed as the cause
  • Broken traceability: an upstream step appears to finish after the next step started, and the lot history falls apart
  • Distorted cycle times: subtracting timestamps from two machines gives negative or absurdly long durations
  • Korea doesn't use daylight saving time, but clock drift is still common. Clocks get set by hand at installation and never touched again, dead RTC batteries reset the time on every reboot, or nobody configured synchronization at all. A typical quartz oscillator with ±20 ppm error drifts about 1.7 seconds a day, or roughly 52 seconds a month.

    Where Should the Timestamp Come From?

    A single event can carry three different timestamps:

  • Event time: when the machine actually detected the change
  • Collection time: when the collector or gateway received the data
  • Storage time: when it was written to the database
  • Network latency and collector buffering can put anywhere from a few hundred milliseconds to several minutes between them. Event time is what you analyze. Collection time is what you check against when you can't trust the machine's clock. So store both, separately. OPC UA separates SourceTimestamp and ServerTimestamp for the same reason.

    You also need one time zone rule for every layer. We recommend storing everything in UTC and converting to KST only for display. When timestamps travel as strings, use ISO 8601 with an explicit offset, such as `2026-11-09T10:02:15.120+09:00`, so values without a zone never get mixed in.

    NTP or PTP?

    NTP

    On a factory LAN, NTP usually holds accuracy within a millisecond, a few milliseconds at worst. That's enough for most MES work: alarm sequencing, production records, and cycle-time calculation.

    PTP (IEEE 1588)

    With switches and NICs that support hardware timestamping, PTP reaches sub-microsecond accuracy. It's meant for multi-axis motion synchronization, high-speed vibration measurement, and equipment where events are less than a millisecond apart. The cost is infrastructure, since you need switches that act as boundary clocks or transparent clocks.

    Building an Internal Time Service

    Don't let OT devices reach internet time servers directly. A typical design looks like this:

  • An upstream NTP server in the DMZ syncs to an external source, such as Korea's national time service (KRISS), or to a GPS receiver
  • Internal time servers on the OT network point only to that upstream server
  • Every device references at least two internal servers, so losing one doesn't matter
  • Handling Equipment That Can't Be Synchronized

    For legacy machines whose clocks you can't change, there are usually two options:

  • Collector-assigned time: ignore the machine's clock and use the synchronized collector's receive time as the event time
  • Measured offset correction: measure the gap between machine time and collection time regularly and apply it as a correction
  • Either way, keep monitoring the error. Log "machine time minus collection time" for each machine every hour, and send an alert when it goes past your tolerance (for example, one second). A sudden jump usually means a dead battery or a reboot.

    In a historian or time-series database, events can share a timestamp, and corrections can make timestamps run backward. Store a per-machine sequence number and treat it as the final word on ordering.

    Adoption Checklist

  • Inventory the time source for every machine (NTP support, reference servers, RTC battery health)
  • Set a tolerance for each use case (e.g., 1 s for MES, 100 ms for quality events, 1 µs for motion)
  • Decide how often to check the error and who receives the alerts
  • Validate consistency on a schedule: count lots with upstream and downstream times reversed, and count negative cycle times
  • How POLYGLOTSOFT Approaches It

    POLYGLOTSOFT builds data collection that records both event time and collection time at the point of capture, with a dashboard that monitors clock error for every machine. We can design the whole thing with you around your site's conditions, from the internal time servers to legacy equipment correction and ordering guarantees in your historian. If you want to know whether you can trust the timestamps in your factory data, get in touch any time.