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 /*    _fxe_system_time_set                                PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    William E. Lamie, Microsoft Corporation                             */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function checks for errors in the set the system time call.    */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    hour                                  Hour (0-23)                   */
48 /*    minute                                Minute (0-59)                 */
49 /*    second                                Second (0-59)                 */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    FX_INVALID_HOUR                       Supplied hour is invalid      */
54 /*    FX_INVALID_MINUTE                     Supplied minute is invalid    */
55 /*    FX_INVALID_SECOND                     Supplied second is invalid    */
56 /*    status                                Actual completion status      */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _fx_system_time_set                   Actual system time set call   */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Application Code                                                    */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
71 /*  09-30-2020     William E. Lamie         Modified comment(s),          */
72 /*                                            resulting in version 6.1    */
73 /*                                                                        */
74 /**************************************************************************/
_fxe_system_time_set(UINT hour,UINT minute,UINT second)75 UINT  _fxe_system_time_set(UINT hour, UINT minute, UINT second)
76 {
77 
78 UINT status;
79 
80 
81     /* Check for invalid hour.  */
82     if (hour > FX_MAXIMUM_HOUR)
83     {
84         return(FX_INVALID_HOUR);
85     }
86 
87     /* Check for invalid minute.  */
88     if (minute > FX_MAXIMUM_MINUTE)
89     {
90         return(FX_INVALID_MINUTE);
91     }
92 
93     /* Check for invalid second.  */
94     if (second > FX_MAXIMUM_SECOND)
95     {
96         return(FX_INVALID_SECOND);
97     }
98 
99     /* Call the actual set system time service.  */
100     status =  _fx_system_time_set(hour, minute, second);
101 
102     /* Return status.  */
103     return(status);
104 }
105 
106