FB_ALY_Timespan
Function block to store and process timespans. Timespans are stored as raw values in accuracy of 1ns. Using the methods of this FB the timespan can be modified, compared or formatted.
Methods
Name | Definition location | Description |
---|---|---|
AddRaw | Local | Method for adding a timespan in raw format. |
AddTimespan | Local | Method for adding a timespan stored in FB_ALY_Timespan. |
SubRaw | Local | Method for subtracting a timespan in raw format. |
SubTimespan | Local | Method for subtracting a timespan stored in FB_ALY_Timespan. |
EqualsTo | Local | Method for comparing two timestamps. |
ToFormatString | Local | Method for formatting the current raw value as a string. |
ToString | Local | Method for formatting the current raw value as a string with configurable precision. |
TotalDays | Local | Method to get the total number of days. |
TotalHours | Local | Method to get the total number of hours. |
TotalMinutes | Local | Method to get the total number of minutes. |
TotalSeconds | Local | Method to get the total number of seconds. |
Sample
VAR
fbTimespan : FB_ALY_Timespan;
sTimespan : STRING;
sFormattedTimespan : STRING;
END_VAR
fbTimespan.AddRaw(TO_LINT(LTIME#1S));
sTimespan := fbTimespan.ToString(eAccuracy := E_ALY_TimestampAccuracy.Second);
sFormattedTimespan := fbTimespan.ToFormatString();
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |