Skip to content

Commit 2594fed

Browse files
committed
minor fixes
* fixed indentation in function 'GET_WEEK_OF_YEAR_INTERNAL' * fixed comment of functions 'GET_DAY_OF_WEEK' and 'GET_WEEK_OF_YEAR'
1 parent 0aca1b9 commit 2594fed

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

UTILITIES_TIME.st

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ IMPLEMENTATION
380380
GET_DAY_OF_WEEK_INTERNAL := UDINT_TO_USINT((in MOD 7 + 1) MOD 7 + 1);
381381
END_FUNCTION
382382

383-
// Returns the numeric day of week (from Monday = 1 to Sunday = 7).
383+
// Returns the numeric day of week.
384384
FUNCTION GET_DAY_OF_WEEK : USINT
385385
VAR_INPUT
386386
in : DATE;
@@ -412,21 +412,21 @@ IMPLEMENTATION
412412
-2, -1, 0: out := 1;
413413
// special handling required for some anchor dates before 2200-12-31
414414
76337, 76336, 76335: out := 1;
415-
ELSE
416-
anchor_date_DISSECTED := DISSECT_DATE_INTERNAL(DINT_TO_UDINT(anchor_date));
417-
anchor_date2 := CREATE_DATE_INTERNAL(anchor_date_DISSECTED.year, 1, 4);
418-
out := DINT_TO_USINT((
419-
anchor_date
420-
- UDINT_TO_DINT(anchor_date2)
421-
+ USINT_TO_DINT(GET_DAY_OF_WEEK_INTERNAL(anchor_date2))
422-
- 4
423-
) / 7 + 1);
415+
ELSE
416+
anchor_date_DISSECTED := DISSECT_DATE_INTERNAL(DINT_TO_UDINT(anchor_date));
417+
anchor_date2 := CREATE_DATE_INTERNAL(anchor_date_DISSECTED.year, 1, 4);
418+
out := DINT_TO_USINT((
419+
anchor_date
420+
- UDINT_TO_DINT(anchor_date2)
421+
+ USINT_TO_DINT(GET_DAY_OF_WEEK_INTERNAL(anchor_date2))
422+
- 4
423+
) / 7 + 1);
424424
END_CASE;
425425

426426
GET_WEEK_OF_YEAR_INTERNAL := out;
427427
END_FUNCTION
428428

429-
// Returns the numeric week of year (from 1st week = 1 to last week = 51, 52 or 53).
429+
// Returns the numeric week of year.
430430
FUNCTION GET_WEEK_OF_YEAR : USINT
431431
VAR_INPUT
432432
in : DATE;

0 commit comments

Comments
 (0)