Hi,
An API send me back information with Linux format time stamp as 32 bits Unsigned Integer like:
1689690756 which means "2023-07-18 14:32:36 UTC". In the parameter to retrieve that value, I set "Measurment" as follow:
<Measurement>
<Type options="time">number</Type>
</Measurement>
And the result is: "19556 days 14h 32m 36s". So, its ok for the hours but not for the date. I couldn't find any reference to Linux time in the "SLC_UM_DataMinerDevelopmentLibrary_REV030" manual. So, is there a way to handle linux time in parameters and translate them properly without going through a QAction which could do the job?
Hi Dominique,
Linux stores time at the number of seconds since Jan 1, 1970 (epoch time). According to the documentation pointed by Koen:
The timestamp is stored internally as an OLE Automation date: a decimal number indicating the total number of days passed since Midnight 1899-12-30.
So I believe you will need to use a QAction that converts the epoch time to OLE Automation date.
You can use the following method to convert the uint to a DateTimeOffset object.
https://learn.microsoft.com/en-us/dotnet/api/system.datetimeoffset.fromunixtimeseconds?view=netframework-4.6.2#system-datetimeoffset-fromunixtimeseconds(system-int64)
This object can then be converted to the OLE format that dataminer is expecting using dateTimeOffset.UtcDateTime.ToOADate().
The option on the parameter must be set to “datetime” instead of “time” to correctly display the date.