5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
26 #define SECS_PER_HOUR 3600ul
27 #define SECS_PER_DAY 86400ul
28 #define TM_YEAR_BASE 1900
30 #define TIME_T_MIN (-LONG_MAX)
31 #define TIME_T_MAX (LONG_MAX)
33 typedef long int gtime_t
;
37 int8_t tm_sec
; /* Seconds. [0-60] (1 leap second) */
38 int8_t tm_min
; /* Minutes. [0-59] */
39 int8_t tm_hour
; /* Hours. [0-23] */
40 int8_t tm_mday
; /* Day. [1-31] */
41 int8_t tm_mon
; /* Month. [0-11] */
42 uint8_t tm_year
; /* Year - 1900. Limited to the year 2155. */
43 int8_t tm_wday
; /* Day of week. [0-6] */
44 int16_t tm_yday
; /* Day of year. [0-365] Needed internally for calculations */
47 extern gtime_t g_rtcTime
;
48 extern uint8_t g_ms100
; // global to allow time set function to reset to zero
51 void rtcSetTime(const struct gtm
* tm
);
52 gtime_t
gmktime (struct gtm
*tm
);
53 uint8_t rtcAdjust(uint16_t year
, uint8_t mon
, uint8_t day
, uint8_t hour
, uint8_t min
, uint8_t sec
);
55 #if defined(__cplusplus) && !defined(SIMU)
58 void gettime(struct gtm
* tm
);
59 #if defined(__cplusplus) && !defined(SIMU)