GCC Code Coverage Report


Directory: common/src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 9 / 0 / 9
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 6 / 0 / 6

fxe_system_time_set.c
Line Branch Exec Source
1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 * Copyright (c) 2026-present Eclipse ThreadX contributors
4 *
5 * This program and the accompanying materials are made available under the
6 * terms of the MIT License which is available at
7 * https://opensource.org/licenses/MIT.
8 *
9 * SPDX-License-Identifier: MIT
10 **************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** FileX Component */
17 /** */
18 /** System */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define FX_SOURCE_CODE
24
25
26 /* Include necessary system files. */
27
28 #include "fx_api.h"
29 #include "fx_system.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _fxe_system_time_set PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* William E. Lamie, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function checks for errors in the set the system time call. */
45 /* */
46 /* INPUT */
47 /* */
48 /* hour Hour (0-23) */
49 /* minute Minute (0-59) */
50 /* second Second (0-59) */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* FX_INVALID_HOUR Supplied hour is invalid */
55 /* FX_INVALID_MINUTE Supplied minute is invalid */
56 /* FX_INVALID_SECOND Supplied second is invalid */
57 /* status Actual completion status */
58 /* */
59 /* CALLS */
60 /* */
61 /* _fx_system_time_set Actual system time set call */
62 /* */
63 /* CALLED BY */
64 /* */
65 /* Application Code */
66 /* */
67 /**************************************************************************/
68 32 UINT _fxe_system_time_set(UINT hour, UINT minute, UINT second)
69 {
70
71 UINT status;
72
73
74 /* Check for invalid hour. */
75
2/2
✓ Branch 2 → 3 taken 8 times.
✓ Branch 2 → 4 taken 24 times.
32 if (hour > FX_MAXIMUM_HOUR)
76 {
77 8 return(FX_INVALID_HOUR);
78 }
79
80 /* Check for invalid minute. */
81
2/2
✓ Branch 4 → 5 taken 8 times.
✓ Branch 4 → 6 taken 16 times.
24 if (minute > FX_MAXIMUM_MINUTE)
82 {
83 8 return(FX_INVALID_MINUTE);
84 }
85
86 /* Check for invalid second. */
87
2/2
✓ Branch 6 → 7 taken 8 times.
✓ Branch 6 → 8 taken 8 times.
16 if (second > FX_MAXIMUM_SECOND)
88 {
89 8 return(FX_INVALID_SECOND);
90 }
91
92 /* Call the actual set system time service. */
93 8 status = _fx_system_time_set(hour, minute, second);
94
95 /* Return status. */
96 8 return(status);
97 }
98
99