1 //*****************************************************************************
2 //
3 //! @file am_util_time.h
4 //!
5 //! @brief Functions useful for RTC, calendar, time, etc. computations.
6 //!
7 //! @addtogroup time Time - RTC Time Computations
8 //! @ingroup utils
9 //! @{
10 //
11 //*****************************************************************************
12 
13 //*****************************************************************************
14 //
15 // Copyright (c) 2023, Ambiq Micro, Inc.
16 // All rights reserved.
17 //
18 // Redistribution and use in source and binary forms, with or without
19 // modification, are permitted provided that the following conditions are met:
20 //
21 // 1. Redistributions of source code must retain the above copyright notice,
22 // this list of conditions and the following disclaimer.
23 //
24 // 2. Redistributions in binary form must reproduce the above copyright
25 // notice, this list of conditions and the following disclaimer in the
26 // documentation and/or other materials provided with the distribution.
27 //
28 // 3. Neither the name of the copyright holder nor the names of its
29 // contributors may be used to endorse or promote products derived from this
30 // software without specific prior written permission.
31 //
32 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
36 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 // POSSIBILITY OF SUCH DAMAGE.
43 //
44 // This is part of revision release_sdk_4_4_0-3c5977e664 of the AmbiqSuite Development Package.
45 //
46 //*****************************************************************************
47 #ifndef AM_UTIL_TIME_H
48 #define AM_UTIL_TIME_H
49 
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif
54 
55 //*****************************************************************************
56 //
57 //! @brief Compute the day of the week given the month, day, and year.
58 //!
59 //! @param iYear  - The year of the desired date (e.g. 2016).
60 //! @param iMonth - The month of the desired date (1-12).
61 //! @param iDay   - The day of the month of the desired date (1-31).
62 //!
63 //! This function is general in nature, but is designed to be used with the RTC.
64 //!
65 //! @returns An index value indicating the day of the week.
66 //! 0-6 indicate  Sun, Mon, Tue, Wed, Thu, Fri, Sat, respectively.
67 //! 7   indicates that the given date is invalid (e.g. 2/29/2015).
68 //
69 //*****************************************************************************
70 extern int am_util_time_computeDayofWeek(int iYear, int iMonth, int iDay);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif // AM_UTIL_TIME_H
77 
78 //*****************************************************************************
79 //
80 // End Doxygen group.
81 //! @}
82 //
83 //*****************************************************************************
84 
85