GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fxe_system_time_set.c Lines: 9 9 100.0 %
Date: 2026-03-06 18:49:02 Branches: 6 6 100.0 %

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
4
UINT  _fxe_system_time_set(UINT hour, UINT minute, UINT second)
69
{
70
71
UINT status;
72
73
74
    /* Check for invalid hour.  */
75
4
    if (hour > FX_MAXIMUM_HOUR)
76
    {
77
1
        return(FX_INVALID_HOUR);
78
    }
79
80
    /* Check for invalid minute.  */
81
3
    if (minute > FX_MAXIMUM_MINUTE)
82
    {
83
1
        return(FX_INVALID_MINUTE);
84
    }
85
86
    /* Check for invalid second.  */
87
2
    if (second > FX_MAXIMUM_SECOND)
88
    {
89
1
        return(FX_INVALID_SECOND);
90
    }
91
92
    /* Call the actual set system time service.  */
93
1
    status =  _fx_system_time_set(hour, minute, second);
94
95
    /* Return status.  */
96
1
    return(status);
97
}
98