Skip to content

Creating a time server

pichler edited this page Feb 24, 2017 · 2 revisions

BACnet provides the following services for time synchronization:

  • TimeSynchronization Service
  • UTCTimeSynchronization Service

bacnet4j provides both services, but note that other vendors or devices may not support time synchronization in general or UTC time synchronization.

To send a time synchronization request (which means, all devices in the network will be synchronized to the specified time), use the following code lines:

com.serotonin.bacnet4j.type.constructed.DateTime time = new DateTime(System.currentTimeMillis());
TimeSynchronizationRequest request = new TimeSynchronizationRequest(time);
localDevice.sendGlobalBroadcast(request);