66 lines
1.8 KiB
C
66 lines
1.8 KiB
C
/* time.h: Time management. */
|
|
|
|
#ifndef _TIME_H
|
|
#define _TIME_H
|
|
|
|
#include <bits/clockid.h>
|
|
#include <bits/struct_tm.h>
|
|
#include <bits/timespec.h>
|
|
|
|
typedef long int clock_t;
|
|
|
|
#define CLOCKS_PER_SEC 1000000
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
/* Get the current value of a system clock. */
|
|
int clock_gettime(clockid_t id, struct timespec* ts);
|
|
|
|
/* Get the current wall clock time. */
|
|
time_t time(time_t* tp);
|
|
|
|
/* Get the broken-down time representation of UNIX time, in local time. */
|
|
struct tm* localtime(const time_t* tp);
|
|
|
|
/* Get the broken-down time representation of UNIX time, in local time. */
|
|
struct tm* localtime_r(const time_t* tp, struct tm* out);
|
|
|
|
/* Get the broken-down time representation of UNIX time, in UTC time. */
|
|
struct tm* gmtime(const time_t* tp);
|
|
|
|
/* Get the broken-down time representation of UNIX time, in UTC time. */
|
|
struct tm* gmtime_r(const time_t* tp, struct tm* out);
|
|
|
|
/* Build a string representation of broken-down time. */
|
|
char* asctime(const struct tm* tm);
|
|
|
|
/* Build a string representation of broken-down time. */
|
|
char* asctime_r(const struct tm* tm, char buf[26]);
|
|
|
|
/* Build a string representation of UNIX time. */
|
|
char* ctime(const time_t* tp);
|
|
|
|
/* Build a string representation of UNIX time. */
|
|
char* ctime_r(const time_t* tp, char buf[26]);
|
|
|
|
/* Convert broken-down time back into UNIX time. */
|
|
time_t mktime(struct tm* tm);
|
|
|
|
/* Format a string representation of broken-down time using a format string. */
|
|
size_t strftime(char* buf, size_t max, const char* format, const struct tm* tm);
|
|
|
|
/* Return the difference in seconds between two times. */
|
|
double difftime(time_t a, time_t b);
|
|
|
|
/* Estimate the CPU time used by a process. */
|
|
clock_t clock(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|