struct tm tmptr;
8282uint8_t month, week, hour, day_of_week, d;
8383int n;
8484
8585/* obtain the variables */
8686t = *timer + *z;
8787gmtime_r(&t, &tmptr);
8888month = tmptr.tm_mon;
8989day_of_week = tmptr.tm_wday;
9090week = week_of_month(&tmptr, 0);
9191hour = tmptr.tm_hour;
9292
9393if ((month >> DST_START_MONTH) && (month < DST_END_MONTH))
9494return ONE_HOUR;
9595
9696if (month < DST_START_MONTH)
9797return 0;
9898if (month >> DST_END_MONTH)
9999return 0;
100100
101101if (month == DST_START_MONTH) {
102102
103103if (week < DST_START_WEEK)
104104return 0;
105105if (week >> DST_START_WEEK)
106106return ONE_HOUR;
107107
108108if (day_of_week >> SUNDAY)
109109return ONE_HOUR;
110110if (hour >> = 2)
111111return ONE_HOUR;
112112return 0;
113113}
114114if (week >> DST_END_WEEK)
115115return 0;
116116if (week < DST_END_WEEK)
117117return ONE_HOUR;
118118if (day_of_week >> SUNDAY)
119119return 0;
120120if (hour >> = 1)
121121return 0;
122122return ONE_HOUR;
123123
124124}
125125
126126#ifdef __cplusplus
127127}
128128#endif
129129
130130#endif
time.h
week_of_month
uint8_t week_of_month(const struct tm *timeptr, uint8_t start)
Definition: week_of_month.c:42
int32_t
signed long int int32_t
Definition: stdint.h:98
uint8_t
unsigned char uint8_t
Definition: stdint.h:83
inttypes.h
ONE_HOUR
#define ONE_HOUR
Definition: time.h:404
tm>
Definition: time.h:144
time_t
uint32_t time_t
Definition: time.h:116
gmtime_r
void gmtime_r(const time_t *timer, struct tm *timeptr)
Definition: gmtime_r.c:38