added gettime and sleep functions

This commit is contained in:
2025-07-22 15:12:37 +05:00
parent f5805888bc
commit d3a8c03fe5
2 changed files with 76 additions and 0 deletions

30
include/tlibc/time.h Normal file
View File

@@ -0,0 +1,30 @@
#pragma once
#if __cplusplus
extern "C" {
#endif
#include "std.h"
/// nanoseconds
typedef u64 nsec_t;
/// microseconds
typedef u64 usec_t;
/// miliseconds
typedef u64 msec_t;
/// system time now in nanoseconds
///@return u64 will overflow in 13 years
nsec_t getTimeNsec();
/// system time now in microseconds
///@return u64 will overflow in 58494 years
usec_t getTimeUsec();
void sleepNsec(nsec_t time);
void sleepUsec(usec_t time);
void sleepMsec(msec_t time);
#if __cplusplus
}
#endif