rtc.h 659 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef _RTC_H
  2. #define _RTC_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /*
  7. * The struct used to pass data via the following ioctl. Similar to the
  8. * struct tm in <time.h>, but it needs to be here so that the kernel
  9. * source is self contained, allowing cross-compiles, etc. etc.
  10. */
  11. typedef struct rtc_time {
  12. int tm_sec;
  13. int tm_min;
  14. int tm_hour;
  15. int tm_mday;
  16. int tm_mon;
  17. int tm_year;
  18. int tm_wday;
  19. int tm_yday;
  20. } SystemTime_t;
  21. static inline int is_leap_year(unsigned int year)
  22. {
  23. return (!(year % 4) && (year % 100)) || !(year % 400);
  24. }
  25. int iGetLocalTime(SystemTime_t *tm);
  26. int iSetLocalTime(SystemTime_t *tm);
  27. #ifdef __cplusplus
  28. }
  29. #endif
  30. #endif