1 2 #ifndef __SYS_KTIME_H__ 3 #define __SYS_KTIME_H__ 4 5 uint64_t Time_GetTSC(); 6 7 typedef struct KTime { 8 int sec; 9 int min; 10 int hour; 11 int month; 12 int year; 13 int mday; 14 int wday; 15 int yday; 16 } KTime; 17 18 typedef uint64_t UnixEpoch; 19 typedef uint64_t UnixEpochNS; 20 21 void KTime_Fixup(KTime *tm); 22 UnixEpoch KTime_ToEpoch(const KTime *tm); 23 void KTime_FromEpoch(UnixEpoch time, KTime *tm); 24 void KTime_SetTime(UnixEpoch epoch, uint64_t tsc, uint64_t tps); 25 void KTime_Tick(int rate); 26 UnixEpoch KTime_GetEpoch(); 27 UnixEpochNS KTime_GetEpochNS(); 28 29 #endif /* __SYS_KTIME_H__ */ 30 31