Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

28 řádky
924 B

  1. #pragma once
  2. #include <Arduino.h>
  3. //convenience macros to convert to and from tm years
  4. #define tmYearToCalendar(Y) ((Y) + 1970) // full four digit year
  5. #define CalendarYrToTm(Y) ((Y) - 1970)
  6. #define tmYearToY2k(Y) ((Y) - 30) // offset is from 2000
  7. #define y2kYearToTm(Y) ((Y) + 30)
  8. /*============================================================================*/
  9. typedef unsigned long timestamp_t;
  10. typedef struct {
  11. uint8_t Second;
  12. uint8_t Minute;
  13. uint8_t Hour;
  14. uint8_t Wday; // day of week, sunday is day 1
  15. uint8_t Day;
  16. uint8_t Month;
  17. uint8_t Year; // offset from 1970;
  18. } tmElements_t, TimeElements, *tmElementsPtr_t;
  19. /* low level functions to convert to and from system time */
  20. void breakTime(timestamp_t time, tmElements_t &tm); // break timestamp_t into elements
  21. timestamp_t makeTime(tmElements_t &tm); // convert time elements into timestamp_t