Structs ¶ DateTime (Struct) Schedule (Struct) Segment (Struct) TimeZone (Struct)
DateTime (STRUCT) ¶ TYPE DateTime : STRUCT Two formats are supported: Absolute format: defines an exact time. “uiYear”, “uiMonth”, “uiDay”, “uiHour”, “uiMinute” and “uiSecond” define the exact time. “uiWeekday” is of no importance. Day of the month format: is selected by setting ”uiYear” to 0. „uiWeekday“ defines a weekday and “uiDay” specifies the day of the month in a value range of 1..5. This notation makes it possible to define the first Sunday in April as well as the last Thursday in October (“uiDay” = 1 corresponds to the first weekday in a month, “uiDay” = 5 corresponds to the last weekday in a month) Note The following applies for the summer time in Europe: The switch to summer time is done on the last Sunday in March. At 2:00 a.m. the clock is set ahead by one hour. The following applies for the winter time (standard time) in Europe: The switch to winter time is done on the last Sunday in October. At 3:00 a.m. the clock is set back by one hour. InOut: Name Type Comment uiYear YEAR uiMonth MONTH uiDay DAY If Year = 0, then 1..5 1 => first day in this month, 5 => last day in this month uiHour HOUR uiMinute MINUTE uiSecond SECOND uiMilliseconds MILLISECOND eWeekday WEEKDAY
YEAR (ALIAS) ¶ TYPE YEAR : UINT (0..2106) 0 or 1970…2106
File and Project Information ¶ Scope Name Type Content FileHeader creationDateTime date 02.03.2023, 10:46:40 companyName string 3S-Smart Software Solutions GmbH libraryFile Util.library primaryProject True productName CODESYS productProfile CODESYS V3.5 SP16 Patch 3 contentFile Util.clean.json version version 2.0.0.0 ProjectInformation AutoResolveUnbound bool True OnlineHelp True Released True ShowSmartCodingInfo True LastModificationDateTime date 02.03.2023, 10:46:37 LibraryCategories library-category-list Application|Common Author string 3S - Smart Software Solutions GmbH Company System CompiledLibraryCompatibilityVersion CODESYS V3.5 SP15 Patch 4 DefaultNamespace Description See: Description DocFormat reStructuredText DocLanguages `` en, de`` Placeholder Util Project Util Title Util UnitTestingDefine TestUtilLibrary Version version 3.5.19.0
Library Reference ¶ This is a dictionary of all referenced libraries and their name spaces. CmpErrors2 Interfaces ¶ Library Identification ¶ Name: CmpErrors2 Interfaces Version: newest Company: System Namespace: CmpErrors Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: CmpErrors2 Interfaces, * (System) Common Behaviour Model ¶ Library Identification ¶ Placeholder: CBML Default Resolution: Common Behaviour Model, * (3S - Smart Software Solutions GmbH) Namespace: CBML Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: True SystemLibrary: False Key: CBML Standard ¶ Library Identification ¶ Placeholder: Standard Default Resolution: Standard, * (System) Namespace: Standard Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: Standard SysMem ¶ Library Identification ¶ Placeholder: SysMem Default Resolution: SysMem, * (System) Namespace: SysMem Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: SysMem SysTimeRtc ¶ Library Identification ¶ Placeholder: SysTimeRtc Default Resolution: SysTimeRtc, * (System) Namespace: SysTimeRtc Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: SysTimeRtc SysTypes2 Interfaces ¶ Library Identification ¶ Name: SysTypes2 Interfaces Version: newest Company: System Namespace: SysTypes Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: SysTypes2 Interfaces, * (System)
TimerSwitch.GetDateTime (METH) ¶ METHOD FINAL GetDateTime : ULINT InOut: Scope Name Type Comment Return GetDateTime ULINT date and (UTC) time in milliseconds since 1.1.1970 00:00:00.000 Output eErrorID ERROR
Schedule (STRUCT) ¶ TYPE Schedule : STRUCT InOut: Name Type Comment usiSwitch USINT Number of the output; Several time periods for each output are possible. [1..32] todFirstOn TOD First time from which the switch is to be switched on todLastOn TOD Last time until which the switch is to be switched on byDayFlags DAYS The day(s) in a week this switch is active
Segment (STRUCT) ¶ TYPE Segment : STRUCT InOut: Name Type sName TZ_NAME dtDate DateTime iBias INT
TimeZone (STRUCT) ¶ TYPE TimeZone : STRUCT To handle the local TIME, it is neccecary to always specify the time and date and the time zone that is currently valid. This makes it possible to convert the local time to C oordinated U niversal T ime and vice versa. UTC is Coordinated Universal Time. It is a successor to, but distinct from, Greenwich Mean Time (GMT) and the various definitions of Universal Time. UTC is now the worldwide standard for regulating clocks and time measurement. All other timezones are defined relative to UTC, and include offsets like UTC+0800 - hours to add or subtract from UTC to derive the local time. No daylight saving time occurs in UTC, making it a useful timezone to perform date arithmetic without worrying about the confusion and ambiguities caused by daylight saving time transitions, your country changing its timezone, or mobile computers that roam through multiple timezones. The following snippet exposes the definition of UTC and C entral E urope T ime/ C entral E urope S ommer T ime. VAR_GLOBAL CONSTANT /// Coordinated Universal Time gc_tzTimeZoneUTC : TimeZone := ( asgPeriod := [(sName:='UTC')] ); /// Central Europe Time gc_tzTimeZoneCET : TimeZone := ( iBias := 60 (* T#1M => minutes *) , asgPeriod := [ ( (* (CEST -> CET) - Last Sunday in Oktober at 03:00:00.000 (CEST) *) sName:='CET', dtDate := (uiMonth := 10, eWeekday := WEEKDAY.SUNDAY, uiDay := 5, uiHour := 3) ),( (* (CET -> CEST) - Last Sunday in March at 02:00:00.000 (CET) *) sName := 'CEST', dtDate := (uiMonth := 3, eWeekday := WEEKDAY.SUNDAY, uiDay := 5, uiHour := 2), iBias := 60 (* T#1M => minutes *) )] ); END_VAR Note The Bias element represents the offset from the Coordinated Universal Time (UTC). This value is in minutes. The offset growing positive in eastern direction starting from the prime meridian. The offset is growing negative in western direction starting from the prime meridian. With the data structure TimeZone it is possible to specify every timezone of the world and so the functions can handle the local time conversion and the switching from standard to day light saving period’s if necessary. Example With the following expressions the difference between the UTC time zone and an other timezone instance can be calculated. iBiasUTC_Standard := gc_tzTimeZoneCET.iBias ; iBiasUTC_Daylight := gc_tzTimeZoneCET.iBias + gc_tzTimeZoneCET.asgPeriod [PERIOD.DAYLIGHT] . iBias ; Note The time zone which the current computer is configured for, is not always the time zone suitable for displaying the current time. Therefore in the respective application, the possibility should be provided, to be able to select the “correct” time zone that is suitable for the related output option (WebVisu, LogFiles, Email, …). InOut: Name Type Comment iBias INT Offset in minutes (local time = UTC + iBias) asgPeriod ARRAY [1..2] OF Segment 1 = PERIOD.STANDARD , 2 = PERIOD.DAYLIGHT
Types ¶ DAY (Alias) DAYS (Alias) HOUR (Alias) MILLISECOND (Alias) MINUTE (Alias) MONTH (Alias) SECOND (Alias) TZ_NAME (Alias) WEEK (Alias) YEAR (Alias)