/* * Copyright (c) mlibc & plct lab * * SPDX-License-Identifier: MIT * * Change Logs: * Date Author Notes * 2023/06/16 bernard the first verison */ #ifndef MLIBC_TIME_H__ #define MLIBC_TIME_H__ #include "sys/types.h" typedef long time_t; typedef long clock_t; struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long __tm_gmtoff; const char *__tm_zone; }; struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* and nanoseconds */ }; struct itimerspec { struct timespec it_interval; struct timespec it_value; }; #define CLOCK_REALTIME 0 #define CLOCK_MONOTONIC 1 #define CLOCK_PROCESS_CPUTIME_ID 2 #define CLOCK_THREAD_CPUTIME_ID 3 #define CLOCK_MONOTONIC_RAW 4 #define CLOCK_REALTIME_COARSE 5 #define CLOCK_MONOTONIC_COARSE 6 #define CLOCK_BOOTTIME 7 #define CLOCK_REALTIME_ALARM 8 #define CLOCK_BOOTTIME_ALARM 9 #define CLOCK_SGI_CYCLE 10 #define CLOCK_TAI 11 #define TIMER_ABSTIME 1 struct tm* gmtime(const time_t* t); struct tm *gmtime_r(const time_t *timep, struct tm *r); struct tm* localtime_r(const time_t* t, struct tm* r); size_t strftime(char *s, size_t maxsize, const char *format, const struct tm *tp); time_t mktime(struct tm* const t); char* ctime(const time_t* tim_p); time_t time(time_t* t); #endif /*MLIBC_TIME_H__*/