time_helper.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* time_helper.h
  2. *
  3. * Copyright (C) 2006-2024 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. /* common Espressif time_helper v5.6.3.001 */
  22. #ifndef _TIME_HELPER_H_
  23. #define _TIME_HELPER_H_
  24. /* ESP-IDF uses a 64-bit signed integer to represent time_t starting from
  25. * release v5.0 See Espressif api-reference/system/system_time
  26. */
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* a function to show the current data and time */
  31. int esp_show_current_datetime(void);
  32. /* worst case, if GitHub time not available, used fixed time */
  33. int set_fixed_default_time(void);
  34. /* set time from string (e.g. GitHub commit time) */
  35. int set_time_from_string(const 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_ */