# Set Gateway time to match PLC time

**URL:** <https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [October 8, 2024, 10:32pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001 "2024-10-08T22:32:49Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![diego.villanueva](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@diego.villanueva](https://forum.inductiveautomation.com/u/diego.villanueva)\
**Post date:** [October 8, 2024, 10:32pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/1 "2024-10-08T22:32:49Z")

</div>

I need to set a CompactLogix as the master time server, but I need to update the Ignition gateway to match that time. How can I go about doing this?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 8, 2024, 10:35pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/2 "2024-10-08T22:35:09Z")

</div>

Point them both to the same NTP server?  
Many companies have their own internal NTP servers.

---

<div class="post-metadata">

**Author:** ![diego.villanueva](https://avatars.discourse-cdn.com/v4/letter/d/838e76/32.png) [@diego.villanueva](https://forum.inductiveautomation.com/u/diego.villanueva)\
**Post date:** [October 8, 2024, 10:36pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/3 "2024-10-08T22:36:18Z")

</div>

Unfortunately, they don't have an NTP server yet. It will be available later so they have requested to set the PLC as time master for now

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 9, 2024, 12:28am UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/4 "2024-10-09T00:28:18Z")

</div>

You'll have to use `system.util.execute` to shell out and execute some command that can sync the time on whatever OS your Ignition Gateway is running on, assuming there is one.

> **[system.util.execute | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-util/system-util-execute)**
>
> Executes the given commands via the operating system, in a separate process.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 9, 2024, 12:38am UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/5 "2024-10-09T00:38:45Z")

</div>

Would it maybe be smarter/easier to have the Ignition server act as the time master? IIRC CompactLogix has quite a bit of clock drift.

For the Compact Logix, if you pass the date time as a 7 numbers (Year, Month, Day, Hour, Minute, Sec, uSec) you can do a single Set System Value instruction to set the UTC clock value.

You could set up a gateway scheduled script to shove the time to the PLC at midnight every night.

---

<div class="post-metadata">

**Author:** ![csjohnson](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@csjohnson](https://forum.inductiveautomation.com/u/csjohnson)\
**Post date:** [October 9, 2024, 2:59am UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/6 "2024-10-09T02:59:32Z")

</div>

I do this for several AB PLCs and works fine.  
Otherwise you must purchase a card to get time from NTP. Sadly a very basic thing is not so basic in an AB PLC.  
Newer models may be able to do some trickery using TCP/Sockets.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 9, 2024, 11:43am UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/7 "2024-10-09T11:43:13Z")

</div>

> [@csjohnson](#):
>
> Sadly a very basic thing is not so basic in an AB PLC.

Simply not true.

All ControlLogix and CompactLogix models since firmware 13 or so can synchronize to a Precision Time Protocol (IEEE 1588) multicast source without any other hardware. Just turn on clock synchronization in the controller properties. (Also have the CPU make "Time Sync" connections to any chassis network cards, for older ControlLogix.)

Rockwell pitched a third party card to provide this for a long time, but many other, much cheaper, devices can be hung on your network to do this. I recommend the Time Machines TM2000B, fwiw. One of those will synchronize every Logix system on a subnet to within single-digit _ **microseconds** _ of UTC via GPS.

Linux systems can use a PTP daemon to participate, too, though the above device also offers NTP to the systems that cannot do the higher-precision PTP.

(IEEE 1588 is a critical part of the suite of technologies now called "Time Sensitive Networking" in audio and video distribution. Rockwell was an early adopter, as NTP doesn't provide servo-loop-quality time sync.)

---

<div class="post-metadata">

**Author:** ![csjohnson](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@csjohnson](https://forum.inductiveautomation.com/u/csjohnson)\
**Post date:** [October 9, 2024, 4:12pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/8 "2024-10-09T16:12:43Z")

</div>

Correct, that is required for cip motion/safety synchronization and is generally used for that.  
A general NTP sync is what I was talking about. It isn't a "native" feature unless you write the code in the PLC to use TCP/Sockets to get the time from an NTP server, or there may be an addon instruction now for it. Otherwise, you would need to write to the WallClock from some other source that is sync'd to an NTP or have some intermediary device like you said.

Personally, if my only requirement was to make sure my real time clock was synced to other devices in my plant, including PCs and servers, I would want to use NTP or write to the WallClock from a source that is sync'd to an NTP that the rest of the plant uses.  
I had not heard of that Time Machine device, thanks for the info.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [October 9, 2024, 4:21pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/9 "2024-10-09T16:21:38Z")

</div>

We use TimeMachines as well as they're inexpensive for what they do. But there is an NTP AOI that Rockwell provides that's flexible to also adjust for DST and gives sync status back on successful or not. I have started dropping it into most every program I write now just in case, and if you have a domain controller, you can point the PLC to one of the DCs and it will grab time off of it.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [October 9, 2024, 4:25pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/10 "2024-10-09T16:25:12Z")

</div>

How accurate is PTP when not using switches that support PTP to modify the PTP packets to adjust the time for the switch processing delays? In theory this should be minimal, but when talking microseconds, it's probably measurable. (If you really need that accurate of time keeping - which not all industries/systems need that accurate)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 9, 2024, 5:40pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/11 "2024-10-09T17:40:38Z")

</div>

If the switches do not make intelligent adjustments, the accuracy degrades from sub-microsecond to single-digit microseconds. I assume stupid switches, which is why I stated that latter above.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [October 9, 2024, 5:58pm UTC](https://forum.inductiveautomation.com/t/set-gateway-time-to-match-plc-time/97001/12 "2024-10-09T17:58:24Z")

</div>

I have a daily gateway script that re-syncs all PLCs to the Ignition gateway's time. Much easier than trying to mess with the PC settings
