Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
817 B

  1. /*
  2. NTP MODULE
  3. Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. Copyright (C) 2019-2021 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
  5. */
  6. #pragma once
  7. #include "espurna.h"
  8. #include "broker.h"
  9. enum class NtpTick {
  10. EveryMinute,
  11. EveryHour
  12. };
  13. struct NtpCalendarWeekday {
  14. int local_wday;
  15. int local_hour;
  16. int local_minute;
  17. int utc_wday;
  18. int utc_hour;
  19. int utc_minute;
  20. };
  21. struct NtpInfo {
  22. String local;
  23. String utc;
  24. String sync;
  25. String tz;
  26. time_t now;
  27. };
  28. BrokerDeclare(NtpBroker, void(NtpTick, time_t, const String&));
  29. NtpInfo ntpInfo();
  30. #if NTP_LEGACY_SUPPORT
  31. time_t ntpLocal2UTC(time_t local);
  32. #endif
  33. String ntpDateTime(tm* timestruct);
  34. String ntpDateTime(time_t ts);
  35. String ntpDateTime();
  36. bool ntpSynced();
  37. void ntpSetup();