amiro-os / core / inc / aos_time.h @ d796dcdf
History | View | Annotate | Download (23.452 KB)
1 |
/*
|
---|---|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al.
|
4 |
|
5 |
This program is free software: you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY) without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/.
|
17 |
*/
|
18 |
|
19 |
/**
|
20 |
* @file aos_time.h
|
21 |
* @brief Time related constants and data types.
|
22 |
*
|
23 |
* @addtogroup aos_time
|
24 |
* @{
|
25 |
*/
|
26 |
|
27 |
#ifndef AMIROOS_TIME_H
|
28 |
#define AMIROOS_TIME_H
|
29 |
|
30 |
#include <amiroos.h> |
31 |
|
32 |
/******************************************************************************/
|
33 |
/* CONSTANTS */
|
34 |
/******************************************************************************/
|
35 |
|
36 |
#define MICROSECONDS_PER_MICROSECOND ((uint8_t) (1)) /**< Number of microseconds per microsecond. */ |
37 |
#define MILLISECONDS_PER_MILLISECOND ((uint8_t) (1)) /**< Number of milliseconds per millisecond. */ |
38 |
#define SECONDS_PER_SECOND ((uint8_t) (1)) /**< Number of seconds per second. */ |
39 |
#define MINUTES_PER_MINUTE ((uint8_t) (1)) /**< Number of minutes per minute. */ |
40 |
#define HOURS_PER_HOUR ((uint8_t) (1)) /**< Number of hours per hour. */ |
41 |
#define DAYS_PER_DAY ((uint8_t) (1)) /**< Number of days per day. */ |
42 |
#define WEEKS_PER_WEEK ((uint8_t) (1)) /**< Number of weeks per week. */ |
43 |
#define MONTHS_PER_MONTH ((uint8_t) (1)) /**< Number of months per month. */ |
44 |
#define YEARS_PER_YEAR ((uint8_t) (1)) /**< Number of years per year. */ |
45 |
#define DECADES_PER_DECADE ((uint8_t) (1)) /**< Number of decades per decade. */ |
46 |
#define CENTURIES_PER_CENTURY ((uint8_t) (1)) /**< Number of centuries per century. */ |
47 |
#define MILLENIA_PER_MILLENIUM ((uint8_t) (1)) /**< Number of millenia per millenium. */ |
48 |
|
49 |
#define MICROSECONDS_PER_MILLISECOND ((uint16_t) (1000)) /**< Number of microseconds per millisecond. */ |
50 |
#define MILLISECONDS_PER_SECOND ((uint16_t) (1000)) /**< Number of milliseconds per second. */ |
51 |
#define SECONDS_PER_MINUTE ((uint8_t) (60)) /**< Number of seconds per minute. */ |
52 |
#define MINUTES_PER_HOUR ((uint8_t) (60)) /**< Number of minutes per hour. */ |
53 |
#define HOURS_PER_DAY ((uint8_t) (24)) /**< Number of hours per day. */ |
54 |
#define DAYS_PER_WEEK ((uint8_t) (7)) /**< Number of days per week. */ |
55 |
#define DAYS_PER_YEAR ((float) (365.25f)) /**< Number of days per year. */ |
56 |
#define MONTHS_PER_YEAR ((uint8_t) (12)) /**< Number of months per year. */ |
57 |
#define YEARS_PER_DECADE ((uint8_t) (10)) /**< Number of years per decade. */ |
58 |
#define DECADES_PER_CENTURY ((uint8_t) (10)) /**< Number of decades per century. */ |
59 |
#define CENTURIES_PER_MILLENIUM ((uint8_t) (10)) /**< Number of centuries per millenium. */ |
60 |
|
61 |
#define MICROSECONDS_PER_SECOND ((uint32_t) ((uint32_t)MICROSECONDS_PER_MILLISECOND * (uint32_t)MILLISECONDS_PER_SECOND)) /**< Number of microseconds per second. */ |
62 |
#define MILLISECONDS_PER_MINUTE ((uint16_t) ((uint16_t)MILLISECONDS_PER_SECOND * (uint16_t)SECONDS_PER_MINUTE)) /**< Number of milliseconds per minute. */ |
63 |
#define SECONDS_PER_HOUR ((uint16_t) ((uint16_t)SECONDS_PER_MINUTE * (uint16_t)MINUTES_PER_HOUR)) /**< Number of seconds per hour. */ |
64 |
#define MINUTES_PER_DAY ((uint16_t) ((uint16_t)MINUTES_PER_HOUR * (uint16_t)HOURS_PER_DAY)) /**< Number of minutes per day. */ |
65 |
#define HOURS_PER_WEEK ((uint8_t) (HOURS_PER_DAY * DAYS_PER_WEEK)) /**< Number of hours per week. */ |
66 |
#define HOURS_PER_YEAR ((uint16_t) ((float)HOURS_PER_DAY * DAYS_PER_YEAR)) /**< Number of hours per year. */ |
67 |
#define DAYS_PER_MONTH ((float) (DAYS_PER_YEAR / (float)MONTHS_PER_YEAR)) /**< Number of days per month. */ |
68 |
#define DAYS_PER_DECADE ((float) (DAYS_PER_YEAR * (float)YEARS_PER_DECADE)) /**< Number of days per decade. */ |
69 |
#define WEEKS_PER_YEAR ((float) (DAYS_PER_YEAR / (float)DAYS_PER_WEEK)) /**< Number of weeks per year. */ |
70 |
#define MONTHS_PER_DECADE ((uint8_t) (MONTHS_PER_YEAR * YEARS_PER_DECADE)) /**< Number of months per decade. */ |
71 |
#define YEARS_PER_CENTURY ((uint8_t) (YEARS_PER_DECADE * DECADES_PER_CENTURY)) /**< Number of years per century. */ |
72 |
#define DECADES_PER_MILLENIUM ((uint8_t) (DECADES_PER_CENTURY * CENTURIES_PER_MILLENIUM)) /**< Number of decades per millenium. */ |
73 |
|
74 |
#define MICROSECONDS_PER_MINUTE ((uint32_t) ((uint32_t)MICROSECONDS_PER_MILLISECOND * (uint32_t)MILLISECONDS_PER_MINUTE)) /**< Number of microseconds per minute. */ |
75 |
#define MILLISECONDS_PER_HOUR ((uint32_t) ((uint32_t)MILLISECONDS_PER_SECOND * (uint32_t)SECONDS_PER_HOUR)) /**< Number of milliseconds per hour. */ |
76 |
#define SECONDS_PER_DAY ((uint32_t) ((uint32_t)SECONDS_PER_MINUTE * (uint32_t)MINUTES_PER_DAY)) /**< Number of seconds per day. */ |
77 |
#define MINUTES_PER_WEEK ((uint16_t) ((uint16_t)MINUTES_PER_HOUR * (uint16_t)HOURS_PER_WEEK)) /**< Number of minutes per week. */ |
78 |
#define HOURS_PER_MONTH ((float) ((float)HOURS_PER_DAY * DAYS_PER_MONTH)) /**< Number of hours per month. */ |
79 |
#define HOURS_PER_DECADE ((uint32_t) ((float)HOURS_PER_DAY * DAYS_PER_DECADE)) /**< Number of hours per decade. */ |
80 |
#define MINUTES_PER_YEAR ((uint32_t) ((uint32_t)MINUTES_PER_HOUR * (uint32_t)HOURS_PER_YEAR)) /**< Number of minutes per year. */ |
81 |
#define DAYS_PER_CENTURY ((uint16_t) (DAYS_PER_YEAR * (float)YEARS_PER_CENTURY)) /**< Number of days per century. */ |
82 |
#define WEEKS_PER_MONTH ((float) (DAYS_PER_MONTH / (float)DAYS_PER_WEEK)) /**< Number of weeks per month. */ |
83 |
#define WEEKS_PER_DECADE ((float) (DAYS_PER_DECADE / (float)DAYS_PER_WEEK)) /**< Number of weeks per decade. */ |
84 |
#define MONTHS_PER_CENTURY ((uint16_t) ((uint16_t)MONTHS_PER_YEAR * (uint16_t)YEARS_PER_CENTURY)) /**< Number of months per century. */ |
85 |
#define YEARS_PER_MILLENIUM ((uint16_t) ((uint16_t)YEARS_PER_DECADE * (uint16_t)DECADES_PER_MILLENIUM)) /**< Number of years per millenium. */ |
86 |
|
87 |
#define MICROSECONDS_PER_HOUR ((uint32_t) ((uint32_t)MICROSECONDS_PER_MILLISECOND * MILLISECONDS_PER_HOUR)) /**< Number of microseconds per hour. */ |
88 |
#define MILLISECONDS_PER_DAY ((uint32_t) ((uint32_t)MILLISECONDS_PER_SECOND * SECONDS_PER_DAY)) /**< Number of milliseconds per day. */ |
89 |
#define SECONDS_PER_WEEK ((uint32_t) (SECONDS_PER_MINUTE * (uint32_t)MINUTES_PER_WEEK)) /**< Number of seconds per week. */ |
90 |
#define SECONDS_PER_YEAR ((uint32_t) (SECONDS_PER_MINUTE * MINUTES_PER_YEAR)) /**< Number of seconds per year. */ |
91 |
#define MINUTES_PER_MONTH ((uint16_t) ((float)MINUTES_PER_HOUR * HOURS_PER_MONTH)) /**< Number of minutes per month. */ |
92 |
#define MINUTES_PER_DECADE ((uint32_t) ((uint32_t)MINUTES_PER_HOUR * HOURS_PER_DECADE)) /**< Number of minutes per decade. */ |
93 |
#define HOURS_PER_CENTURY ((uint32_t) ((uint32_t)HOURS_PER_DAY * (uint32_t)DAYS_PER_CENTURY)) /**< Number of hours per century. */ |
94 |
#define DAYS_PER_MILLENIUM ((uint32_t) (DAYS_PER_YEAR * (float)YEARS_PER_MILLENIUM)) /**< Number of days per millenium. */ |
95 |
#define WEEKS_PER_CENTURY ((float) ((float)DAYS_PER_CENTURY / (float)DAYS_PER_WEEK)) /**< Number of weeks per century. */ |
96 |
#define MONTHS_PER_MILLENIUM ((uint16_t) ((uint16_t)MONTHS_PER_YEAR * YEARS_PER_MILLENIUM)) /**< Number of months per millenium. */ |
97 |
|
98 |
#define MICROSECONDS_PER_DAY ((uint64_t) ((uint64_t)MICROSECONDS_PER_MILLISECOND * (uint64_t)MILLISECONDS_PER_DAY)) /**< Number of microseconds per day. */ |
99 |
#define MILLISECONDS_PER_WEEK ((uint32_t) ((uint32_t)MILLISECONDS_PER_SECOND * SECONDS_PER_WEEK)) /**< Number of milliseconds per week. */ |
100 |
#define MILLISECONDS_PER_YEAR ((uint64_t) ((uint64_t)MILLISECONDS_PER_SECOND * (uint64_t)SECONDS_PER_YEAR)) /**< Number of milliseconds per year. */ |
101 |
#define SECONDS_PER_MONTH ((uint32_t) ((uint32_t)SECONDS_PER_MINUTE * (uint32_t)MINUTES_PER_MONTH)) /**< Number of seconds per month. */ |
102 |
#define SECONDS_PER_DECADE ((uint32_t) ((uint32_t)SECONDS_PER_MINUTE * MINUTES_PER_DECADE)) /**< Number of seconds per decade. */ |
103 |
#define MINUTES_PER_CENTURY ((uint32_t) ((uint32_t)MINUTES_PER_HOUR * HOURS_PER_CENTURY)) /**< Number of minutes per century. */ |
104 |
#define HOURS_PER_MILLENIUM ((uint32_t) ((uint32_t)HOURS_PER_DAY * DAYS_PER_MILLENIUM)) /**< Number of hours per millenium. */ |
105 |
#define WEEKS_PER_MILLENIUM ((float) ((float)DAYS_PER_MILLENIUM / (float)DAYS_PER_WEEK)) /**< Number of weeks per millenium. */ |
106 |
|
107 |
#define MICROSECONDS_PER_WEEK ((uint64_t) ((uint64_t)MICROSECONDS_PER_MILLISECOND * (uint64_t)MILLISECONDS_PER_WEEK)) /**< Number of microseconds per week. */ |
108 |
#define MICROSECONDS_PER_YEAR ((uint64_t) ((uint64_t)MICROSECONDS_PER_MILLISECOND * MILLISECONDS_PER_YEAR)) /**< Number of microseconds per year. */ |
109 |
#define MILLISECONDS_PER_MONTH ((uint32_t) ((uint32_t)MILLISECONDS_PER_SECOND * SECONDS_PER_MONTH)) /**< Number of milliseconds per month. */ |
110 |
#define MILLISECONDS_PER_DECADE ((uint64_t) ((uint64_t)MILLISECONDS_PER_SECOND * (uint64_t)SECONDS_PER_DECADE)) /**< Number of milliseconds per decade. */ |
111 |
#define SECONDS_PER_CENTURY ((uint32_t) (SECONDS_PER_MINUTE * MINUTES_PER_CENTURY)) /**< Number of seconds per century. */ |
112 |
#define MINUTES_PER_MILLENIUM ((uint32_t) ((uint32_t)MINUTES_PER_HOUR * HOURS_PER_MILLENIUM)) /**< Number of minutes per millenium. */ |
113 |
|
114 |
#define MICROSECONDS_PER_MONTH ((uint64_t) ((uint64_t)MICROSECONDS_PER_MILLISECOND * (uint64_t)MILLISECONDS_PER_MONTH)) /**< Number of microseconds per month. */ |
115 |
#define MICROSECONDS_PER_DECADE ((uint64_t) ((uint64_t)MICROSECONDS_PER_MILLISECOND * MILLISECONDS_PER_DECADE)) /**< Number of microseconds per decade. */ |
116 |
#define MILLISECONDS_PER_CENTURY ((uint64_t) ((uint64_t)MILLISECONDS_PER_SECOND * (uint64_t)SECONDS_PER_CENTURY)) /**< Number of milliseconds per century. */ |
117 |
#define SECONDS_PER_MILLENIUM ((uint64_t) ((uint64_t)SECONDS_PER_MINUTE * (uint64_t)MINUTES_PER_MILLENIUM)) /**< Number of seconds per millenium. */ |
118 |
|
119 |
#define MICROSECONDS_PER_CENTURY ((uint64_t) ((uint64_t)MICROSECONDS_PER_MILLISECOND * MILLISECONDS_PER_CENTURY)) /**< Number of microseconds per century. */ |
120 |
#define MILLISECONDS_PER_MILLENIUM ((uint64_t) ((uint64_t)MILLISECONDS_PER_SECOND * SECONDS_PER_MILLENIUM)) /**< Number of milliseconds per millenium. */ |
121 |
|
122 |
#define MICROSECONDS_PER_MILLENIUM ((uint64_t) ((uint64_t)MICROSECONDS_PER_MILLISECOND * MILLISECONDS_PER_MILLENIUM)) /**< Number of microseconds per millenium. */ |
123 |
|
124 |
#define MILLISECONDS_PER_MICROSECOND ((float)MILLISECONDS_PER_MILLISECOND / (float)MICROSECONDS_PER_MILLISECOND) /**< Fraction of a millisecond per microsecond. */ |
125 |
|
126 |
#define SECONDS_PER_MICROSECOND ((float)SECONDS_PER_SECOND / (float)MICROSECONDS_PER_SECOND) /**< Fraction of a second per microsecond. */ |
127 |
#define SECONDS_PER_MILLISECOND ((float)SECONDS_PER_SECOND / (float)MILLISECONDS_PER_SECOND) /**< Fraction of a second per millisecond. */ |
128 |
|
129 |
#define MINUTES_PER_MICROSECOND ((float)MINUTES_PER_MINUTE / (float)MICROSECONDS_PER_MINUTE) /**< Fraction of a minute per microsecond. */ |
130 |
#define MINUTES_PER_MILLISECOND ((float)MINUTES_PER_MINUTE / (float)MILLISECONDS_PER_MINUTE) /**< Fraction of a minute per millisecond. */ |
131 |
#define MINUTES_PER_SECOND ((float)MINUTES_PER_MINUTE / (float)SECONDS_PER_MINUTE) /**< Fraction of a minute per second. */ |
132 |
|
133 |
#define HOURS_PER_MICROSECOND ((float)HOURS_PER_HOUR / (float)MICROSECONDS_PER_HOUR) /**< Fraction of an hour per microsecond. */ |
134 |
#define HOURS_PER_MILLISECOND ((float)HOURS_PER_HOUR / (float)MILLISECONDS_PER_HOUR) /**< Fraction of an hour per millisecond. */ |
135 |
#define HOURS_PER_SECOND ((float)HOURS_PER_HOUR / (float)SECONDS_PER_HOUR) /**< Fraction of an hour per second. */ |
136 |
#define HOURS_PER_MINUTE ((float)HOURS_PER_HOUR / (float)MINUTES_PER_HOUR) /**< Fraction of an hour per minute. */ |
137 |
|
138 |
#define DAYS_PER_MICROSECOND ((float)DAYS_PER_DAY / (float)MICROSECONDS_PER_DAY) /**< Fraction of a day per microsecond. */ |
139 |
#define DAYS_PER_MILLISECOND ((float)DAYS_PER_DAY / (float)MILLISECONDS_PER_DAY) /**< Fraction of a day per millisecond. */ |
140 |
#define DAYS_PER_SECOND ((float)DAYS_PER_DAY / (float)SECONDS_PER_DAY) /**< Fraction of a day per second. */ |
141 |
#define DAYS_PER_MINUTE ((float)DAYS_PER_DAY / (float)MINUTES_PER_DAY) /**< Fraction of a day per minute. */ |
142 |
#define DAYS_PER_HOUR ((float)DAYS_PER_DAY / (float)HOURS_PER_DAY) /**< Fraction of a day per hour. */ |
143 |
|
144 |
#define WEEKS_PER_MICROSECOND ((float)WEEKS_PER_WEEK / (float)MICROSECONDS_PER_WEEK) /**< Fraction of a week per microsecond. */ |
145 |
#define WEEKS_PER_MILLISECOND ((float)WEEKS_PER_WEEK / (float)MILLISECONDS_PER_WEEK) /**< Fraction of a week per millisecond. */ |
146 |
#define WEEKS_PER_SECOND ((float)WEEKS_PER_WEEK / (float)SECONDS_PER_WEEK) /**< Fraction of a week per second. */ |
147 |
#define WEEKS_PER_MINUTE ((float)WEEKS_PER_WEEK / (float)MINUTES_PER_WEEK) /**< Fraction of a week per minute. */ |
148 |
#define WEEKS_PER_HOUR ((float)WEEKS_PER_WEEK / (float)HOURS_PER_WEEK) /**< Fraction of a week per hour. */ |
149 |
#define WEEKS_PER_DAY ((float)WEEKS_PER_WEEK / (float)DAYS_PER_WEEK) /**< Fraction of a week per day. */ |
150 |
|
151 |
#define MONTHS_PER_MICROSECOND ((float)MONTHS_PER_MONTH / (float)MICROSECONDS_PER_MONTH) /**< Fraction of a month per microsecond. */ |
152 |
#define MONTHS_PER_MILLISECOND ((float)MONTHS_PER_MONTH / (float)MILLISECONDS_PER_MONTH) /**< Fraction of a month per millisecond. */ |
153 |
#define MONTHS_PER_SECOND ((float)MONTHS_PER_MONTH / (float)SECONDS_PER_MONTH) /**< Fraction of a month per second. */ |
154 |
#define MONTHS_PER_MINUTE ((float)MONTHS_PER_MONTH / (float)MINUTES_PER_MONTH) /**< Fraction of a month per minute. */ |
155 |
#define MONTHS_PER_HOUR ((float)MONTHS_PER_MONTH / (float)HOURS_PER_MONTH) /**< Fraction of a month per hour. */ |
156 |
#define MONTHS_PER_DAY ((float)MONTHS_PER_MONTH / (float)DAYS_PER_MONTH) /**< Fraction of a month per day. */ |
157 |
#define MONTHS_PER_WEEK ((float)MONTHS_PER_MONTH / (float)WEEKS_PER_MONTH) /**< Fraction of a month per week. */ |
158 |
|
159 |
#define YEARS_PER_MICROSECOND ((float)YEARS_PER_YEAR / (float)MICROSECONDS_PER_YEAR) /**< Fraction of a year per microsecond. */ |
160 |
#define YEARS_PER_MILLISECOND ((float)YEARS_PER_YEAR / (float)MILLISECONDS_PER_YEAR) /**< Fraction of a year per millisecond. */ |
161 |
#define YEARS_PER_SECOND ((float)YEARS_PER_YEAR / (float)SECONDS_PER_YEAR) /**< Fraction of a year per second. */ |
162 |
#define YEARS_PER_MINUTE ((float)YEARS_PER_YEAR / (float)MINUTES_PER_YEAR) /**< Fraction of a year per minute. */ |
163 |
#define YEARS_PER_HOUR ((float)YEARS_PER_YEAR / (float)HOURS_PER_YEAR) /**< Fraction of a year per hour. */ |
164 |
#define YEARS_PER_DAY ((float)YEARS_PER_YEAR / (float)DAYS_PER_YEAR) /**< Fraction of a year per day. */ |
165 |
#define YEARS_PER_WEEK ((float)YEARS_PER_YEAR / (float)WEEKS_PER_YEAR) /**< Fraction of a year per week. */ |
166 |
#define YEARS_PER_MONTH ((float)YEARS_PER_YEAR / (float)MONTHS_PER_YEAR) /**< Fraction of a year per month. */ |
167 |
|
168 |
#define DECADES_PER_MICROSECOND ((float)DECADES_PER_DECADE / (float)MICROSECONDS_PER_DECADE) /**< Fraction of a decade per microsecond. */ |
169 |
#define DECADES_PER_MILLISECOND ((float)DECADES_PER_DECADE / (float)MILLISECONDS_PER_DECADE) /**< Fraction of a decade per millisecond. */ |
170 |
#define DECADES_PER_SECOND ((float)DECADES_PER_DECADE / (float)SECONDS_PER_DECADE) /**< Fraction of a decade per second. */ |
171 |
#define DECADES_PER_MINUTE ((float)DECADES_PER_DECADE / (float)MINUTES_PER_DECADE) /**< Fraction of a decade per minute. */ |
172 |
#define DECADES_PER_HOUR ((float)DECADES_PER_DECADE / (float)HOURS_PER_DECADE) /**< Fraction of a decade per hour. */ |
173 |
#define DECADES_PER_DAY ((float)DECADES_PER_DECADE / (float)DAYS_PER_DECADE) /**< Fraction of a decade per day. */ |
174 |
#define DECADES_PER_WEEK ((float)DECADES_PER_DECADE / (float)WEEKS_PER_DECADE) /**< Fraction of a decade per week. */ |
175 |
#define DECADES_PER_MONTH ((float)DECADES_PER_DECADE / (float)MONTHS_PER_DECADE) /**< Fraction of a decade per month. */ |
176 |
#define DECADES_PER_YEAR ((float)DECADES_PER_DECADE / (float)YEARS_PER_DECADE) /**< Fraction of a decade per year. */ |
177 |
|
178 |
#define CENTURIES_PER_MICROSECOND ((float)CENTURIES_PER_CENTURY / (float)MICROSECONDS_PER_CENTURY) /**< Fraction of a century per microsecond. */ |
179 |
#define CENTURIES_PER_MILLISECOND ((float)CENTURIES_PER_CENTURY / (float)MILLISECONDS_PER_CENTURY) /**< Fraction of a century per millisecond. */ |
180 |
#define CENTURIES_PER_SECOND ((float)CENTURIES_PER_CENTURY / (float)SECONDS_PER_CENTURY) /**< Fraction of a century per second. */ |
181 |
#define CENTURIES_PER_MINUTE ((float)CENTURIES_PER_CENTURY / (float)MINUTES_PER_CENTURY) /**< Fraction of a century per minute. */ |
182 |
#define CENTURIES_PER_HOUR ((float)CENTURIES_PER_CENTURY / (float)HOURS_PER_CENTURY) /**< Fraction of a century per hour. */ |
183 |
#define CENTURIES_PER_DAY ((float)CENTURIES_PER_CENTURY / (float)DAYS_PER_CENTURY) /**< Fraction of a century per day. */ |
184 |
#define CENTURIES_PER_WEEK ((float)CENTURIES_PER_CENTURY / (float)WEEKS_PER_CENTURY) /**< Fraction of a century per week. */ |
185 |
#define CENTURIES_PER_MONTH ((float)CENTURIES_PER_CENTURY / (float)MONTHS_PER_CENTURY) /**< Fraction of a century per month. */ |
186 |
#define CENTURIES_PER_YEAR ((float)CENTURIES_PER_CENTURY / (float)YEARS_PER_CENTURY) /**< Fraction of a century per year. */ |
187 |
#define CENTURIES_PER_DECADE ((float)CENTURIES_PER_CENTURY / (float)DECADES_PER_CENTURY) /**< Fraction of a century per decade. */ |
188 |
|
189 |
#define MILLENIA_PER_MICROSECOND ((float)MILLENIA_PER_MILLENIUM / (float)MICROSECONDS_PER_MILLENIUM) /**< Fraction of a millenium per microsecond. */ |
190 |
#define MILLENIA_PER_MILLISECOND ((float)MILLENIA_PER_MILLENIUM / (float)MILLISECONDS_PER_MILLENIUM) /**< Fraction of a millenium per millisecond. */ |
191 |
#define MILLENIA_PER_SECOND ((float)MILLENIA_PER_MILLENIUM / (float)SECONDS_PER_MILLENIUM) /**< Fraction of a millenium per second. */ |
192 |
#define MILLENIA_PER_MINUTE ((float)MILLENIA_PER_MILLENIUM / (float)MINUTES_PER_MILLENIUM) /**< Fraction of a millenium per minute. */ |
193 |
#define MILLENIA_PER_HOUR ((float)MILLENIA_PER_MILLENIUM / (float)HOURS_PER_MILLENIUM) /**< Fraction of a millenium per hour. */ |
194 |
#define MILLENIA_PER_DAY ((float)MILLENIA_PER_MILLENIUM / (float)DAYS_PER_MILLENIUM) /**< Fraction of a millenium per day. */ |
195 |
#define MILLENIA_PER_WEEK ((float)MILLENIA_PER_MILLENIUM / (float)WEEKS_PER_MILLENIUM) /**< Fraction of a millenium per week. */ |
196 |
#define MILLENIA_PER_MONTH ((float)MILLENIA_PER_MILLENIUM / (float)MONTHS_PER_MILLENIUM) /**< Fraction of a millenium per month. */ |
197 |
#define MILLENIA_PER_YEAR ((float)MILLENIA_PER_MILLENIUM / (float)YEARS_PER_MILLENIUM) /**< Fraction of a millenium per year. */ |
198 |
#define MILLENIA_PER_DECADE ((float)MILLENIA_PER_MILLENIUM / (float)DECADES_PER_MILLENIUM) /**< Fraction of a millenium per decade. */ |
199 |
#define MILLENIA_PER_CENTURY ((float)MILLENIA_PER_MILLENIUM / (float)CENTURIES_PER_MILLENIUM) /**< Fraction of a millenium per century. */ |
200 |
|
201 |
/******************************************************************************/
|
202 |
/* SETTINGS */
|
203 |
/******************************************************************************/
|
204 |
|
205 |
/******************************************************************************/
|
206 |
/* CHECKS */
|
207 |
/******************************************************************************/
|
208 |
|
209 |
/******************************************************************************/
|
210 |
/* DATA STRUCTURES AND TYPES */
|
211 |
/******************************************************************************/
|
212 |
|
213 |
/**
|
214 |
* @brief Generic time to represent long time frames at high precision.
|
215 |
* @note By definition the temporal resolution is 1us.
|
216 |
*/
|
217 |
typedef uint64_t aos_timestamp_t;
|
218 |
|
219 |
/**
|
220 |
* @brief generic time to represent medium length time frames at high precision.
|
221 |
* @note By definition the temporal resolution is 1us.
|
222 |
*/
|
223 |
typedef uint32_t aos_interval_t;
|
224 |
|
225 |
/**
|
226 |
* @brief Generic time to represent long time frames at high precision.
|
227 |
* @note By definition the temporal resolution is 1us.
|
228 |
*/
|
229 |
typedef aos_timestamp_t aos_longinterval_t;
|
230 |
|
231 |
/******************************************************************************/
|
232 |
/* MACROS */
|
233 |
/******************************************************************************/
|
234 |
|
235 |
/******************************************************************************/
|
236 |
/* EXTERN DECLARATIONS */
|
237 |
/******************************************************************************/
|
238 |
|
239 |
#if defined(__cplusplus)
|
240 |
extern "C" { |
241 |
#endif /* defined(__cplusplus) */ |
242 |
uint8_t aosTimeDayOfWeekFromDate(const uint16_t day, const uint8_t month, const uint16_t year); |
243 |
#if defined(__cplusplus)
|
244 |
} |
245 |
#endif /* defined(__cplusplus) */ |
246 |
|
247 |
/******************************************************************************/
|
248 |
/* INLINE FUNCTIONS */
|
249 |
/******************************************************************************/
|
250 |
|
251 |
#endif /* AMIROOS_TIME_H */ |
252 |
|
253 |
/** @} */
|