user_time.h 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. #ifndef __USER_TIME_H__
  2. #define __USER_TIME_H__
  3. #include "SPIFFS.h"
  4. #include <stdbool.h>
  5. void user_time_init();
  6. void user_time_handler();
  7. #include <stdlib.h>
  8. #include <time.h>
  9. #include <unistd.h>
  10. #include <sys/time.h>
  11. void setRtcTime(unsigned int year, unsigned int month, unsigned int day,
  12. unsigned int hour, unsigned int minute, unsigned int second);
  13. void getRtcTime(Machine_info_t *info);
  14. bool is_sync_time(Machine_info_t *info);
  15. long long calculate_minutes_difference(int year1, int month1, int day1, int hour1, int minute1, int second1,
  16. int year2, int month2, int day2, int hour2, int minute2, int second2);
  17. void printRtcTime(char * data);
  18. // void timestampToStr(const char* timestamp_str, char* output_buffer, int size, int timezone_offset);
  19. // char* extractTimestamp(const char* input_str);
  20. #if 0
  21. void timestamp_to_local_time(const char *timestamp, int *year, int *month, int *day, int *hour, int *minute, int *second);
  22. #else
  23. void timestamp_to_local_time(const char *timestamp, int offset, int *year, uint8_t *month, uint8_t *day, uint8_t *hour, uint8_t *minute, uint8_t *second);
  24. #endif
  25. #endif