The local system time should always be obtained through the pitm_systime function. This function handles the necessary conversion of the system time to pi time, compensating for time zone and daylight savings time when necessary.
Many of the PI-API functions deal with time-relative information, and the PI-API node should be time synchronized with the server node. In high performance applications, it is also advisable to avoid costly network calls to obtain the server time. Several methods are available to provide server-synchronized time without incurring frequent network calls.
Pitm_syncwithservertime may be called from a privileged process to modify the local system time to match the server node. Most platforms require system or root user privileges to set the system clock.
Pitm_fastservertime uses a locally stored offset between the local system and the server time to provide approximate server times based on local system time calls. This function periodically updates the offset value by obtaining the server time.
The functions pisn_putsnapshot, pisn_putsnapshotq and pisn_putsnapshots, when passed a 0 for the time value, obtain the current time value on the server after being sent. If buffering is enabled, the time values are provided locally with the pitm_fastservertime call. The functions pisn_sendexcepstruc, pisn_sendexceptionq, and pisn_sendexceptions , on the other hand, will query the local system time when they encounter a new time value of 0.