add rtc_time compatibility for older kernels (#504)

* KernelSU: add rtc_time compatibility for older kernels

* KernelSU: add rtc_time compatibility for older kernels
This commit is contained in:
MorStar
2025-10-31 21:55:04 +08:00
committed by GitHub
parent 343c6452cf
commit 4b1bbda3b1

View File

@@ -14,6 +14,25 @@
#include <linux/spinlock.h>
#include <linux/crc32.h>
#if __has_include(<linux/rtc.h>)
#include <linux/rtc.h>
#endif
#ifndef time64_to_tm
static inline void time64_to_tm(time64_t totalsecs, int offset, struct tm *result)
{
struct rtc_time rtc_tm;
rtc_time64_to_tm(totalsecs, &rtc_tm);
result->tm_sec = rtc_tm.tm_sec;
result->tm_min = rtc_tm.tm_min;
result->tm_hour = rtc_tm.tm_hour;
result->tm_mday = rtc_tm.tm_mday;
result->tm_mon = rtc_tm.tm_mon;
result->tm_year = rtc_tm.tm_year;
}
#endif
#include "klog.h"
#include "kernel_compat.h"
#include "sulog.h"
@@ -406,4 +425,4 @@ void ksu_sulog_exit(void)
pr_info("sulog: cleaned up successfully\n");
}
#endif // __SULOG_GATE
#endif // __SULOG_GATE