2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2018-10-25 17:29:49 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-07-15 15:22:45 +02:00
|
|
|
// Includes essentially mandated by POSIX:
|
|
|
|
|
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
2021-08-14 15:42:24 +02:00
|
|
|
#include <Kernel/API/POSIX/time.h>
|
2022-08-16 01:57:43 +10:00
|
|
|
#include <sys/cdefs.h>
|
2018-10-25 17:29:49 +02:00
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
__BEGIN_DECLS
|
2018-10-25 17:29:49 +02:00
|
|
|
|
2018-11-17 00:11:08 +01:00
|
|
|
struct tm {
|
2019-05-28 11:53:16 +02:00
|
|
|
int tm_sec; /* Seconds (0-60) */
|
|
|
|
|
int tm_min; /* Minutes (0-59) */
|
|
|
|
|
int tm_hour; /* Hours (0-23) */
|
|
|
|
|
int tm_mday; /* Day of the month (1-31) */
|
|
|
|
|
int tm_mon; /* Month (0-11) */
|
|
|
|
|
int tm_year; /* Year - 1900 */
|
|
|
|
|
int tm_wday; /* Day of the week (0-6, Sunday = 0) */
|
|
|
|
|
int tm_yday; /* Day in the year (0-365, 1 Jan = 0) */
|
|
|
|
|
int tm_isdst; /* Daylight saving time */
|
2018-11-17 00:11:08 +01:00
|
|
|
};
|
|
|
|
|
|
2020-03-05 19:30:24 +08:00
|
|
|
extern long timezone; /* The difference in seconds between UTC and local time */
|
2019-02-08 02:38:21 +01:00
|
|
|
extern long altzone;
|
|
|
|
|
extern char* tzname[2];
|
|
|
|
|
extern int daylight;
|
2018-11-17 00:11:08 +01:00
|
|
|
|
2022-04-01 20:58:27 +03:00
|
|
|
struct tm* localtime(time_t const*);
|
|
|
|
|
struct tm* gmtime(time_t const*);
|
2019-02-25 10:05:32 +01:00
|
|
|
time_t mktime(struct tm*);
|
2020-08-20 15:44:10 -04:00
|
|
|
time_t timegm(struct tm*);
|
2018-10-25 17:29:49 +02:00
|
|
|
time_t time(time_t*);
|
2022-04-01 20:58:27 +03:00
|
|
|
char* ctime(time_t const*);
|
|
|
|
|
char* ctime_r(time_t const* tm, char* buf);
|
2022-01-08 15:32:59 +01:00
|
|
|
void tzset(void);
|
2019-05-28 11:53:16 +02:00
|
|
|
char* asctime(const struct tm*);
|
2021-04-19 22:20:13 -07:00
|
|
|
char* asctime_r(const struct tm*, char* buf);
|
2019-05-17 20:19:03 +02:00
|
|
|
|
2022-01-08 15:32:59 +01:00
|
|
|
clock_t clock(void);
|
2019-05-17 20:19:03 +02:00
|
|
|
|
2019-11-02 19:34:06 +01:00
|
|
|
int clock_gettime(clockid_t, struct timespec*);
|
2020-03-13 01:18:21 +02:00
|
|
|
int clock_settime(clockid_t, struct timespec*);
|
2019-11-02 19:34:06 +01:00
|
|
|
int clock_nanosleep(clockid_t, int flags, const struct timespec* requested_sleep, struct timespec* remaining_sleep);
|
2019-11-11 14:08:20 +01:00
|
|
|
int clock_getres(clockid_t, struct timespec* result);
|
2020-06-08 21:53:41 +02:00
|
|
|
int nanosleep(const struct timespec* requested_sleep, struct timespec* remaining_sleep);
|
2022-04-01 20:58:27 +03:00
|
|
|
struct tm* gmtime_r(time_t const* timep, struct tm* result);
|
|
|
|
|
struct tm* localtime_r(time_t const* timep, struct tm* result);
|
2019-11-02 19:34:06 +01:00
|
|
|
|
2019-02-25 10:05:32 +01:00
|
|
|
double difftime(time_t, time_t);
|
2022-04-01 20:58:27 +03:00
|
|
|
size_t strftime(char* s, size_t max, char const* format, const struct tm*) __attribute__((format(strftime, 3, 0)));
|
2018-10-25 17:29:49 +02:00
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
__END_DECLS
|