This function returns an estimate of the server time without placing a network call to the PI Server each time it is called. It returns the current local time plus the offset between the server time and the local system time. The function periodically updates the offset. When the current server time is needed frequently, this function should be used instead of pitm_servertime.

C format

int32 pitm_fastservertime( void)


Current server time in PI format. Returns a time value of 0 if there is a problem.



Usage Notes

You must connect to a server prior to calling this function for the first time. When connecting to multiple servers, you must call piut_setservernode or pilg_setservernode successfully before calling this function to ensure the time returned is from the proper server.

The PI-API normaly prevents step changes in the offset between the PI Server and the client of more than 10 minutes. For instance, if the time clock on the client should be inadvertently adjusted by more than 10 minutes the offset between the client and server times will not be changed by the PI-API. During daylight savings changes, if the client and server change settings at different times due to a few minutes difference in the system clock times, pitm_fastservertime will retain the old server/client time difference until both have completed the transition.

This feature creates a problem if one of the nodes honors daylight savings and the other does not. In that case, the client program must be stopped and restarted after the time transition has completed for pitm_fastservertime to work correctly.

Situations in which the client and server have different rules regarding daylight savings changes may also be handled using the DSTMISMATCH setting. The DSTMISMATCH setting handles the case when it is valid to have a change in time offset between the server and client that is greater than 10 minutes. For example, in the case of different DST rules on the server and client node, there may be a jump of 1 hour in the time offset between the server and client. For instance, if one node is in Perth (without daylight savings) and one node is in Sydney (with daylight savings), DSTMISMATCH should be set to 3600 seconds.

On UNIX nodes, the piclient.ini file section [PISERVER] may contain the DSTMISMATCH key that contains the number of seconds the time offset between the two nodes will change after a DST adjustment.

For Windows PI-API nodes, multiple servers may be entered into the pilogin.ini file. To enable the DSTMISMATCH compensation for servers, add an entry in the [DEFAULTS] section of DSTMISMATCH# where # is the same number used in the [PINodeIdentifiers] section for the PI Server. For example, a server casaba has an identifier number of 2 in the [PINodeIdentifiers] section as shown here: PI2=casaba ,34618,545. Use a DSTMISMATCH2=3600 entry in the [DEFAULTS] section.

Enabling Operational Intelligence