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

fx_system_time_get.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 /* _fx_system_time_get PORTABLE C */
37 /* 6.1.7 */
38 /* AUTHOR */
39 /* */
40 /* William E. Lamie, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function returns the current contents of the system time in */
45 /* the fields specified by the caller. */
46 /* */
47 /* INPUT */
48 /* */
49 /* hour Pointer to hour */
50 /* minute Pointer to minute */
51 /* second Pointer to second */
52 /* */
53 /* OUTPUT */
54 /* */
55 /* FX_SUCCESS */
56 /* */
57 /* CALLS */
58 /* */
59 /* None */
60 /* */
61 /* CALLED BY */
62 /* */
63 /* Application Code */
64 /* */
65 /**************************************************************************/
66 18 UINT _fx_system_time_get(UINT *hour, UINT *minute, UINT *second)
67 {
68
69 UINT time;
70
71
72 /* Get a copy of the current system time. */
73 18 time = _fx_system_time;
74
75 /* Check to see if the hour is required. */
76
2/2
✓ Branch 2 → 3 taken 9 times.
✓ Branch 2 → 4 taken 9 times.
18 if (hour)
77 {
78
79 /* Pickup the hour. */
80 9 *hour = (time >> FX_HOUR_SHIFT) & FX_HOUR_MASK;
81 }
82
83 /* Check to see if the minute is required. */
84
2/2
✓ Branch 4 → 5 taken 9 times.
✓ Branch 4 → 6 taken 9 times.
18 if (minute)
85 {
86
87 /* Pickup the minute. */
88 9 *minute = (time >> FX_MINUTE_SHIFT) & FX_MINUTE_MASK;
89 }
90
91 /* Check to see if the second is required. */
92
2/2
✓ Branch 6 → 7 taken 9 times.
✓ Branch 6 → 8 taken 9 times.
18 if (second)
93 {
94
95 /* Pickup the second. */
96 9 *second = (time & FX_SECOND_MASK) * 2;
97 }
98
99 /* If trace is enabled, insert this event into the trace buffer. */
100 if (hour && minute && second)
101 {
102 FX_TRACE_IN_LINE_INSERT(FX_TRACE_SYSTEM_TIME_GET, *hour, *minute, *second, 0, FX_TRACE_INTERNAL_EVENTS, 0, 0)
103 }
104
105 /* Return successful status. */
106 18 return(FX_SUCCESS);
107 }
108
109