time_helper.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (C) 2006-2024 wolfSSL Inc.
  3. *
  4. * This file is part of wolfSSL.
  5. *
  6. * wolfSSL is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * wolfSSL is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  19. */
  20. /* common Espressif time_helper v5.6.3.001 */
  21. #ifndef _TIME_HELPER_H
  22. #define _TIME_HELPER_H
  23. /* ESP-IDF uses a 64-bit signed integer to represent time_t starting from release v5.0
  24. * See: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#year-2036-and-2038-overflow-issues
  25. */
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /* a function to show the current data and time */
  30. int esp_show_current_datetime();
  31. /* worst case, if GitHub time not available, used fixed time */
  32. int set_fixed_default_time(void);
  33. /* set time from string (e.g. GitHub commit time) */
  34. /* When not using the new esp-sdk-lib.h helpers: */
  35. /* int set_time_from_string(char* time_buffer); */
  36. /* set time from NTP servers,
  37. * also initially calls set_fixed_default_time or set_time_from_string */
  38. int set_time(void);
  39. /* wait NTP_RETRY_COUNT seconds before giving up on NTP time */
  40. int set_time_wait_for_ntp(void);
  41. #ifdef __cplusplus
  42. } /* extern "C" */
  43. #endif
  44. #endif /* #ifndef _TIME_HELPER_H */