rtc.h 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /*
  22. * This data structure is inspired by the EFI (v0.92) wakeup
  23. * alarm API.
  24. */
  25. struct rtc_wkalrm {
  26. unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */
  27. unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */
  28. struct rtc_time time; /* time the alarm is set to */
  29. };
  30. static inline int is_leap_year(unsigned int year)
  31. {
  32. return (!(year % 4) && (year % 100)) || !(year % 400);
  33. }
  34. int rtc_init(void);
  35. int iGetLocalTime(SystemTime_t *tm);
  36. int iSetLocalTime(SystemTime_t *tm);
  37. #ifdef __cplusplus
  38. }
  39. #endif
  40. #endif