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_date_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 date in */ |
45 |
|
|
/* the fields specified by the caller. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* year Pointer to year */ |
50 |
|
|
/* month Pointer to month */ |
51 |
|
|
/* day Pointer to day */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* FX_SUCCESS */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* None */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* Application Code */ |
64 |
|
|
/* */ |
65 |
|
|
/**************************************************************************/ |
66 |
|
2 |
UINT _fx_system_date_get(UINT *year, UINT *month, UINT *day) |
67 |
|
|
{ |
68 |
|
|
|
69 |
|
|
UINT date; |
70 |
|
|
|
71 |
|
|
|
72 |
|
|
/* Get a copy of the current date. */ |
73 |
|
2 |
date = _fx_system_date; |
74 |
|
|
|
75 |
|
|
/* Check to see if the year is required. */ |
76 |
✓✓ |
2 |
if (year) |
77 |
|
|
{ |
78 |
|
|
|
79 |
|
|
/* Pickup the year. */ |
80 |
|
1 |
*year = ((date >> FX_YEAR_SHIFT) & FX_YEAR_MASK) + FX_BASE_YEAR; |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
/* Check to see if the month is required. */ |
84 |
✓✓ |
2 |
if (month) |
85 |
|
|
{ |
86 |
|
|
|
87 |
|
|
/* Pickup the month. */ |
88 |
|
1 |
*month = (date >> FX_MONTH_SHIFT) & FX_MONTH_MASK; |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
/* Check to see if the day is required. */ |
92 |
✓✓ |
2 |
if (day) |
93 |
|
|
{ |
94 |
|
|
|
95 |
|
|
/* Pickup the day. */ |
96 |
|
1 |
*day = date & FX_DAY_MASK; |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
/* If trace is enabled, insert this event into the trace buffer. */ |
100 |
|
|
if (year && month && day) |
101 |
|
|
{ |
102 |
|
|
FX_TRACE_IN_LINE_INSERT(FX_TRACE_SYSTEM_DATE_GET, *year, *month, *day, 0, FX_TRACE_INTERNAL_EVENTS, 0, 0) |
103 |
|
|
} |
104 |
|
|
|
105 |
|
|
/* Return successful status. */ |
106 |
|
2 |
return(FX_SUCCESS); |
107 |
|
|
} |
108 |
|
|
|