void tzset(void) { char *z, *a; strcpy(std_name, "GMT"); strcpy(dst_name, "GMT"); __tzname[0] = std_name; __tzname[1] = dst_name; __timezone = 0; __daylight = 0; if (!(z = getenv("TZ")) || !isalpha(*z)) return; zname(std_name, &z); __timezone = hhmmss(&z); zname(dst_name, &z); if (dst_name[0]) __daylight=1; a = z; __dst_offset = hhmmss(&z) - __timezone; if (z==a) __dst_offset = -3600; if (dstrule(&__dst_start, &z) || dstrule(&__dst_end, &z)) __daylight = 0; }
static int dstrule(struct rule *rule, char **s) { if (**s != ',') return -1; switch (*++*s) { case 'J': rule->month = 'J'; rule->day = strtol(*s+1, s, 10)-1; break; case 'M': rule->month = strtol(*s+1, s, 10)-1; if (**s != '.' || rule->month < 0 || rule->month > 11) return -1; rule->week = strtol(*s+1, s, 10)-1; if (**s != '.' || rule->week < 0 || rule->week > 4) return -1; rule->day = strtol(*s+1, s, 10); if (rule->day < 0 || rule->day > 6) return -1; break; default: rule->month = 'L'; rule->day = strtol(*s+1, s, 10); break; } if (**s == '/') { (*s)++; rule->time = hhmmss(s); } else rule->time = 7200; return 0; }
/** * @brief arduino setup function */ void setup() { Serial.begin(9600); Display::Init(); if (RTC.get() == 0) { // following line sets the RTC to the date & time this sketch was compiled RTC.set(hhmmss()); } setSyncProvider(RTC.get); // the function to get the time from the RTC // Transmitter is connected to Arduino Pin #10 mySwitch.enableTransmit(7); dallastemp.begin(); // Inizialisieren der Dallas Temperature library dallastemp.setWaitForConversion(false); aqua.begin(); pinMode(BUTTON_PIN_1, INPUT_PULLUP); pinMode(BUTTON_PIN_2, INPUT_PULLUP); // pinMode(BUTTON_PIN_3, INPUT_PULLUP); // pinMode(BUTTON_PIN_4, INPUT_PULLUP); }