fx_system_time_set.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_set PORTABLE C */ | ||
| 37 | /* 6.1 */ | ||
| 38 | /* AUTHOR */ | ||
| 39 | /* */ | ||
| 40 | /* William E. Lamie, Microsoft Corporation */ | ||
| 41 | /* */ | ||
| 42 | /* DESCRIPTION */ | ||
| 43 | /* */ | ||
| 44 | /* This function set the system time to the value specified by the */ | ||
| 45 | /* caller. */ | ||
| 46 | /* */ | ||
| 47 | /* INPUT */ | ||
| 48 | /* */ | ||
| 49 | /* hour Hour (0-23) */ | ||
| 50 | /* minute Minute (0-59) */ | ||
| 51 | /* second Second (0-59) */ | ||
| 52 | /* */ | ||
| 53 | /* OUTPUT */ | ||
| 54 | /* */ | ||
| 55 | /* FX_SUCCESS */ | ||
| 56 | /* */ | ||
| 57 | /* CALLS */ | ||
| 58 | /* */ | ||
| 59 | /* None */ | ||
| 60 | /* */ | ||
| 61 | /* CALLED BY */ | ||
| 62 | /* */ | ||
| 63 | /* Application Code */ | ||
| 64 | /* */ | ||
| 65 | /**************************************************************************/ | ||
| 66 | 9 | UINT _fx_system_time_set(UINT hour, UINT minute, UINT second) | |
| 67 | { | ||
| 68 | |||
| 69 | |||
| 70 | /* If trace is enabled, insert this event into the trace buffer. */ | ||
| 71 | FX_TRACE_IN_LINE_INSERT(FX_TRACE_SYSTEM_TIME_SET, hour, minute, second, 0, FX_TRACE_INTERNAL_EVENTS, 0, 0) | ||
| 72 | |||
| 73 | /* Set the new system time. */ | ||
| 74 | 9 | _fx_system_time = (hour << FX_HOUR_SHIFT) | | |
| 75 | 9 | (minute << FX_MINUTE_SHIFT) | (second / 2); | |
| 76 | |||
| 77 | /* Return successful status. */ | ||
| 78 | 9 | return(FX_SUCCESS); | |
| 79 | } | ||
| 80 | |||
| 81 |