Utility Functions
Utility Functions Overview
Utility functions ease programming. Time stamp conversion functions are necessary to produce the time stamps needed in most API functions.
Utility Functions
IHU_timestamp_FromParts
Use the IHU_timestamp_FromParts
function to use supplied time parts (date, hour, minutes, seconds, and so on) to produce a UTC time stamp in the format needed by the Historian User API read and write calls.
Prototype
IHU_timestamp_FromParts {
in int Year,
in int Month,
in int Day,
in int Hour,
in int Minute,
in int Second,
in long Subsecond,
out IHU_timestamp *time stamp
};
Remarks
The time parts passed in are assumed to be in the local time zone of the machine where you make the call.
During UTC conversion, the Use Daylight Saving Time setting of your local machine is used.
Returns
The IHU_timestamp_FromParts
function returns ihuSTATUS_OK
on success, or an error code on failure.
IHU_timestamp_ToParts
Use the IHU_timestamp_ToParts
function to convert UTC time stamps to the following human-readable parts:
Year
Month
Date
Hour
Minute
Second
Subsecond
You can use this function to convert the time stamps of retrieved data samples.
Prototype
IHU_timestamp_ToParts {
in IHU_timestamp time stamp
out int *Year,
out int *Month,
out int *Day,
out int *Hour,
out int *Minute,
out int *Second,
out long *Subsecond,
};
Remarks
The time parts produced are in the local time zone of the machine where you make the call.
During conversion from UTC, the Use Daylight Saving Time setting of your local machine is used.
Returns
The IHU_timestamp_ToParts
function returns ihuSTATUS_OK
on success, or an error code on failure.
ihuServerGetTime
Use the ihuServerGetTime
function to return the current time on the Historian server.
Prototype
ihuErrorCode IHUAPI ihuServerGetTime
(
long serverhandle,
IHU_TIMESTAMP *CurrentTime
)
Remarks
The ihuServerGetTime
function has the following inputs and outputs:
hServer
: Server handle from the connectionCurrentTime
: Current time on the server in the local time zone
Returns
The ihuServerGetTime
function returns ihuSTATUS_OK
on success, or an error code on failure.