weAutSys definition of timing services
This is system software and must not be modified for user or application programs.
This file is part of weAutSys <weinert-automation.de>
Copyright © 2011 Albrecht Weinert, Bochum
Data Structures | |
struct | datdur_t |
"Time since" as a structure: a duration or a date/time More... | |
struct | date_t |
Date structure: a date in our time. More... | |
struct | dst_rule_year_t |
Rule structure: DST rules for a given (set of) year(s) More... | |
struct | timer_t |
The timer data type resp. More... | |
Defines | |
#define | DEFAULT_START_TIME |
Reset (or default) start time. | |
#define | MARCH_2008_NTP 3413318400 |
March 2008 as NTP seconds. | |
#define | MARCH_2008_UNIX 1204329600 |
March 2008 as UNIX seconds. | |
#define | ms_TIMER_TYPE |
A milliseconds based timer. | |
#define | MSEC_DAY 86400000 |
Milliseconds per day. | |
#define | MSEC_HOUR 3600000 |
Milliseconds per hour. | |
#define | MSEC_MINUTE 60000 |
Milliseconds per minute. | |
#define | MSEC_WEEK |
Milliseconds per week. | |
#define | OFFSET2NTPTIME |
same as MARCH_2008_NTP | |
#define | OFFSET2UNIXTIME |
same as MARCH_2008_UNIX | |
#define | sec_dat_TIMER_TYPE |
A date / time oriented timer with seconds resolution. | |
#define | sec_dur_TIMER_TYPE |
A duration / period oriented timer with seconds resolution. | |
#define | SECONDS_IN_DAY 86400 |
Seconds in a day. | |
#define | SECONDS_IN_WEEK |
Seconds in a week. | |
#define | SECONDS_IN_YEAR |
Seconds in a (normal) year. | |
#define | secTime308Loc(x) |
Seconds since March 1st 2008 local time. | |
#define | startTime308UTC |
The reset / start time in seconds since March 1st 2008 UTC. | |
#define | TIMER_LAPSED 0x00 |
Timer lapsed. | |
#define | TIMER_RUNNING |
Timer running. | |
#define | TIMER_STATE_MASK |
upper 4 bits of timer.state (the state) | |
#define | TIMER_STOPPED |
Timer stopped. | |
#define | TIMER_TYPE_DEFAULT |
Set type to default or leave untouched. | |
#define | TIMER_TYPE_FREE |
Timer free. | |
#define | TIMER_TYPE_MASK |
lower 4 (2) bits of timer.state (the type) | |
#define | TIMER_UNUSED |
Timer unused. | |
#define | timerLapsed(timer) |
Is a timer lapsed. | |
#define | timerRunning(timer) |
Is a timer running. | |
#define | zoneOffsetSec |
The time zone offset in seconds. | |
#define | zoneOffsetZone |
zoneOffsetSec's byte [1] | |
Date calculation defines | |
#define | DAYS_IN_YEAR |
Days in a year. | |
#define | DAYS_IN4YEARS |
Days in four years. | |
#define | APRIL_OFF |
Offset of April. | |
#define | MAY_OFF |
Offset of May. | |
#define | JUNE_OFF |
Offset of June. | |
#define | JULY_OFF |
Offset of July. | |
#define | AUGUST_OFF |
Offset of August. | |
#define | SEPTEMBER_OFF |
Offset of September. | |
#define | OCTOBER_OFF |
Offset of October. | |
#define | NOVEMBER_OFF |
Offset of November. | |
#define | DECEMBER_OFF |
Offset of December. | |
#define | JANUARY_OFF |
Offset of (next) January. | |
#define | FEBRUARY_OFF |
Offset of (next) February. | |
#define | MARCH_2012 |
March 2012. | |
#define | MARCH_2016 |
March 2016. | |
#define | MARCH_2020 |
March 2020. | |
#define | MARCH_2100 |
March 2100. | |
Functions | |
uint32_t | datdur2sec (datdur_t *timStr) |
Calculate seconds from a datdur_t structure. | |
char * | formDateIso (char *s, date_t *tDat) |
Format a date (date_t structure) | |
char * | formTimDur (char *s, datdur_t *tRun) |
Format a time (datdur_t structure) as duration. | |
char * | formTimOfD (char *s, datdur_t *tTim) |
Format a time (datdur_t structure) as time of day. | |
char * | formWdShort (char *s, uint8_t wd) |
Format the day of week as short clear text. | |
void | freeTimer (struct timer_t *timer) |
Free a timer. | |
const dst_rule_year_t * | getDSTrule (uint8_t year) |
Get the EU, US &c DST rule data for a given year. | |
uint32_t | getFATtime (void) |
The local time as FAT time. | |
void | haltTimer (struct timer_t *timer) |
Halt a timer. | |
uint8_t | initTimer (struct timer_t *timer, uint32_t period, uint8_t type) |
Initialise a timer. | |
uint8_t | isEUdstSwitchDay (date_t *datStr) |
Is date represented in date structure EU DST switching day. | |
uint32_t | msClock (void) __attribute__((always_inline)) |
Milliseconds since power up. | |
uint8_t | parseDate (date_t *dat, char s[], uint8_t si) |
Parse a date. | |
uint8_t | parseTim (datdur_t *tim, char s[], uint8_t si) |
Parse a (clock) time. | |
void | pauseTimer (struct timer_t *timer) |
Stop / pause a timer. | |
struct timer_t * | removeTimerFromList (const struct timer_t *timer, struct timer_t *list) |
Remove a timer from a list. | |
void | restartTimer (struct timer_t *timer) |
Start a timer with its own interval from now. | |
void | sec2datdur (datdur_t *timStr, uint32_t timSec) |
Convert seconds to a datdur_t structure. | |
uint32_t | secClock (void) __attribute__((always_inline)) |
The system's run time in seconds. | |
uint32_t | secTime308UTC (void) __attribute__((always_inline)) |
Seconds since March 1st 2008 UTC. | |
uint32_t | secTimeNtpUTC (uint32_t secTime308UTC) __attribute__((always_inline)) |
Convert to seconds since January 1st 1990 UTC (NTP time) | |
uint32_t | secTimeUnixUTC (uint32_t secTime308UTC) __attribute__((always_inline)) |
Convert to seconds since January 1st 1970 UTC (Unix time) | |
uint8_t | setDST (uint8_t dlt) |
Set if current time is DST. | |
uint8_t | setZoneOffsetSec (uint32_t newOffset) |
Adjust / set zone offset. | |
void | startNextInterval (struct timer_t *timer) |
Start a timer's next interval. | |
void | startTimer (struct timer_t *timer, uint32_t period, uint8_t type) |
Start a timer with interval / type from now. | |
void | startTimerAbs (struct timer_t *timer, uint32_t endTime, uint8_t type) |
Start a timer (with absolute end time) | |
Date handling functions | |
uint8_t | setDatByDays (date_t *datStr, uint16_t ds) |
Set date structure by days since since March 2008. | |
uint16_t | getDaysByDat (date_t *datStr) |
Get days since since March 2008 by date structure. | |
uint8_t | getMarchYearByDays (uint16_t *daysInYear, uint16_t ds) |
Get year starting March (includes next January and February) | |
Variables | |
uint8_t | adjustUTCcount |
Count of secTime308Loc adjustments. | |
uint32_t | combinedOffset |
The combined offset (local - UTC) | |
uint8_t | isDST |
Is current time DST. | |
uint16_t | msAbsClockCount |
The system ms clock value for local time. | |
uint16_t | msSystClockCount |
The system ms counter / clock value for running / system up time. | |
struct timer_t | msTimers |
The system milliseconds time and timers. | |
struct timer_t | secDatTimers |
The system seconds resolution date / time oriented timers. | |
struct timer_t | secDurTimers |
The system seconds resolution duration oriented timers. | |
struct timer_t * | timerLists [] |
The list of timer lists. | |
char * | wDaysShort [] |
flash array of the (flash) short weekdays |