Utility Functions

Important: You do not have the latest version of Historian! You are missing out on the newest capabilities and enhanced security. For information on all the latest features, see the Historian product page. For more information on upgrades, contact your GE Digital sales agent or e-mail GE Digital Sales Support. For the most up-to-date documentation, go here.

Utility Functions Overview

Utility Functions

Utility functions ease programming. Time stamp conversion functions are necessary to produce the time stamps needed in most API functions.

IHU_timestamp_FromParts

Prototype

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.

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

Prototype

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.

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

Prototype

Use the ihuServerGetTime function to return the current time on the Historian server.

ihuErrorCode IHUAPI ihuServerGetTime
(
    long serverhandle,
    IHU_TIMESTAMP *CurrentTime
)

Remarks

The ihuServerGetTime function has the following inputs and outputs:

  • hServer: Server handle from the connection
  • CurrentTime: 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.