2022-06-06 01:30:01 +00:00
|
|
|
#pragma once
|
2022-06-08 04:24:27 +00:00
|
|
|
#include <stddef.h>
|
2022-06-06 01:30:01 +00:00
|
|
|
|
|
|
|
#if !defined(NULL)
|
2022-06-08 04:24:27 +00:00
|
|
|
#define NULL ((void *)0)
|
2022-06-06 01:30:01 +00:00
|
|
|
#endif
|
2022-06-02 06:28:17 +00:00
|
|
|
|
|
|
|
// The number of clock ticks per second
|
|
|
|
#define CLOCKS_PER_SEC ((clock_t)1000)
|
2022-06-08 04:24:27 +00:00
|
|
|
|
2022-06-02 06:28:17 +00:00
|
|
|
#define TIME_UTC 1
|
|
|
|
|
2022-06-08 04:24:27 +00:00
|
|
|
typedef size_t clock_t;
|
|
|
|
typedef size_t time_t;
|
|
|
|
|
2022-06-02 06:28:17 +00:00
|
|
|
struct timespec {
|
|
|
|
time_t tv_sec; // Seconds - >= 0
|
|
|
|
long tv_nsec; // Nanoseconds - [0, 999999999]
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tm {
|
|
|
|
int tm_sec; // seconds after the minute - [0, 60] including leap second
|
|
|
|
int tm_min; // minutes after the hour - [0, 59]
|
|
|
|
int tm_hour; // hours since midnight - [0, 23]
|
|
|
|
int tm_mday; // day of the month - [1, 31]
|
|
|
|
int tm_mon; // months since January - [0, 11]
|
|
|
|
int tm_year; // years since 1900
|
|
|
|
int tm_wday; // days since Sunday - [0, 6]
|
|
|
|
int tm_yday; // days since January 1 - [0, 365]
|
|
|
|
int tm_isdst; // daylight savings time flag
|
|
|
|
};
|
|
|
|
|
|
|
|
clock_t clock(void);
|
|
|
|
double difftime(time_t time1, time_t time0);
|
|
|
|
time_t mktime(struct tm *timeptr);
|
|
|
|
time_t time(time_t *timer);
|
2022-06-08 04:24:27 +00:00
|
|
|
int timespec_get(struct timespec *ts, int base);
|
2022-06-02 06:28:17 +00:00
|
|
|
char *asctime(const struct tm *timeptr);
|
|
|
|
char *ctime(const time_t *timer);
|
|
|
|
struct tm *gmtime(const time_t *timer);
|
|
|
|
struct tm *localtime(const time_t *timer);
|
|
|
|
size_t strftime(char * restrict s, size_t maxsize, const char * restrict format, const struct tm * restrict timeptr);
|
|
|
|
|
|
|
|
#ifdef __STDC_WANT_LIB_EXT1__
|
2022-06-08 04:24:27 +00:00
|
|
|
errno_t asctime_s(char *s, rsize_t maxsize, const struct tm *timeptr);
|
|
|
|
errno_t ctime_s(char *s, rsize_t maxsize, const time_t *timer);
|
|
|
|
struct tm *gmtime_s(const time_t * restrict timer, struct tm * restrict result);
|
|
|
|
struct tm *localtime_s(const time_t * restrict timer, struct tm * restrict result);
|
2022-06-02 06:28:17 +00:00
|
|
|
#endif
|