1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** FileX Component */
16 /** */
17 /** System */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define FX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "fx_api.h"
28 #include "fx_system.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _fx_system_time_get PORTABLE C */
36 /* 6.1.7 */
37 /* AUTHOR */
38 /* */
39 /* William E. Lamie, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function returns the current contents of the system time in */
44 /* the fields specified by the caller. */
45 /* */
46 /* INPUT */
47 /* */
48 /* hour Pointer to hour */
49 /* minute Pointer to minute */
50 /* second Pointer to second */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* FX_SUCCESS */
55 /* */
56 /* CALLS */
57 /* */
58 /* None */
59 /* */
60 /* CALLED BY */
61 /* */
62 /* Application Code */
63 /* */
64 /* RELEASE HISTORY */
65 /* */
66 /* DATE NAME DESCRIPTION */
67 /* */
68 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
69 /* 09-30-2020 William E. Lamie Modified comment(s), */
70 /* resulting in version 6.1 */
71 /* 06-02-2021 William E. Lamie Modified comment(s), */
72 /* checked null pointer, */
73 /* resulting in version 6.1.7 */
74 /* */
75 /**************************************************************************/
_fx_system_time_get(UINT * hour,UINT * minute,UINT * second)76 UINT _fx_system_time_get(UINT *hour, UINT *minute, UINT *second)
77 {
78
79 UINT time;
80
81
82 /* Get a copy of the current system time. */
83 time = _fx_system_time;
84
85 /* Check to see if the hour is required. */
86 if (hour)
87 {
88
89 /* Pickup the hour. */
90 *hour = (time >> FX_HOUR_SHIFT) & FX_HOUR_MASK;
91 }
92
93 /* Check to see if the minute is required. */
94 if (minute)
95 {
96
97 /* Pickup the minute. */
98 *minute = (time >> FX_MINUTE_SHIFT) & FX_MINUTE_MASK;
99 }
100
101 /* Check to see if the second is required. */
102 if (second)
103 {
104
105 /* Pickup the second. */
106 *second = (time & FX_SECOND_MASK) * 2;
107 }
108
109 /* If trace is enabled, insert this event into the trace buffer. */
110 if (hour && minute && second)
111 {
112 FX_TRACE_IN_LINE_INSERT(FX_TRACE_SYSTEM_TIME_GET, *hour, *minute, *second, 0, FX_TRACE_INTERNAL_EVENTS, 0, 0)
113 }
114
115 /* Return successful status. */
116 return(FX_SUCCESS);
117 }
118
119