Tizen RT Libs&Environment  v1.0 D5
time.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 /****************************************************************************
19  *
20  * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
21  * Author: Gregory Nutt <gnutt@nuttx.org>
22  *
23  * Redistribution and use in source and binary forms, with or without
24  * modification, are permitted provided that the following conditions
25  * are met:
26  *
27  * 1. Redistributions of source code must retain the above copyright
28  * notice, this list of conditions and the following disclaimer.
29  * 2. Redistributions in binary form must reproduce the above copyright
30  * notice, this list of conditions and the following disclaimer in
31  * the documentation and/or other materials provided with the
32  * distribution.
33  * 3. Neither the name NuttX nor the names of its contributors may be
34  * used to endorse or promote products derived from this software
35  * without specific prior written permission.
36  *
37  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
38  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
39  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
40  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
41  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
42  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
43  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
44  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
45  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
46  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
47  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
48  * POSSIBILITY OF SUCH DAMAGE.
49  *
50  ****************************************************************************/
53 
54 #ifndef __INCLUDE_TINYARA_TIME_H
55 #define __INCLUDE_TINYARA_TIME_H
56 
57 /****************************************************************************
58  * Included Files
59  ****************************************************************************/
60 
61 #include <tinyara/config.h>
62 
63 #include <stdbool.h>
64 #include <time.h>
65 
66 /****************************************************************************
67  * Pre-processor Definitions
68  ****************************************************************************/
69 
70 /* If Gregorian time is not supported, then neither is Julian */
71 
72 #ifndef CONFIG_GREGORIAN_TIME
73 #undef CONFIG_JULIAN_TIME
74 #else
75 #define JD_OF_EPOCH 2440588 /* Julian Date of noon, J1970 */
76 
77 #ifdef CONFIG_JULIAN_TIME
78 #define GREG_DUTC -141427 /* Default is October 15, 1582 */
79 #define GREG_YEAR 1582
80 #define GREG_MONTH 10
81 #define GREG_DAY 15
82 #endif /* CONFIG_JULIAN_TIME */
83 #endif /* !CONFIG_GREGORIAN_TIME */
84 
85 /****************************************************************************
86  * Public Data
87  ****************************************************************************/
88 
89 /****************************************************************************
90  * Public Function Prototypes
91  ****************************************************************************/
92 
93 #ifdef __cplusplus
94 #define EXTERN extern "C"
95 extern "C" {
96 #else
97 #define EXTERN extern
98 #endif
99 
107 EXTERN int clock_isleapyear(int year);
108 
117 EXTERN int clock_daysbeforemonth(int month, bool leapyear);
118 
132 EXTERN time_t clock_calendar2utc(int year, int month, int day);
133 
134 #undef EXTERN
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /* __INCLUDE_TINYARA_TIME_H */
EXTERN time_t clock_calendar2utc(int year, int month, int day)
Conversion Calendar/UTC.
#define EXTERN
Definition: time.h:97
uint32_t time_t
Definition: time.h:145
EXTERN int clock_isleapyear(int year)
Return true if the specified year is a leap year.
EXTERN int clock_daysbeforemonth(int month, bool leapyear)
Get the number of days that occurred before the beginning of the month.
Time APIs.