2012-09-28 18:36:46 -04:00
|
|
|
/*******************************************************************************
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2014-02-13 16:06:10 -05:00
|
|
|
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013, 2014.
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
This file is part of the Sortix C Library.
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
option) any later version.
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2013-07-10 09:26:01 -04:00
|
|
|
time.h
|
|
|
|
Time declarations.
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2012-05-28 16:51:20 -04:00
|
|
|
*******************************************************************************/
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2013-10-13 17:37:06 -04:00
|
|
|
#ifndef INCLUDE_TIME_H
|
|
|
|
#define INCLUDE_TIME_H
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2013-10-13 07:04:27 -04:00
|
|
|
#include <sys/cdefs.h>
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2013-09-23 10:37:33 -04:00
|
|
|
#include <sys/__/types.h>
|
|
|
|
|
2012-03-04 12:36:04 -05:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
2013-12-26 19:44:03 -05:00
|
|
|
#ifndef __clock_t_defined
|
|
|
|
#define __clock_t_defined
|
|
|
|
typedef __clock_t clock_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __size_t_defined
|
|
|
|
#define __size_t_defined
|
|
|
|
#define __need_size_t
|
|
|
|
#include <stddef.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __time_t_defined
|
|
|
|
#define __time_t_defined
|
|
|
|
typedef __time_t time_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __clockid_t_defined
|
|
|
|
#define __clockid_t_defined
|
|
|
|
typedef __clockid_t clockid_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __timer_t_defined
|
|
|
|
#define __timer_t_defined
|
|
|
|
typedef __timer_t timer_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __locale_t_defined
|
|
|
|
#define __locale_t_defined
|
|
|
|
/* TODO: figure out what this does and typedef it properly. This is just a
|
|
|
|
temporary assignment. */
|
|
|
|
typedef int __locale_t;
|
|
|
|
typedef __locale_t locale_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __pid_t_defined
|
|
|
|
#define __pid_t_defined
|
|
|
|
typedef __pid_t pid_t;
|
|
|
|
#endif
|
2012-12-29 16:57:02 -05:00
|
|
|
|
2013-10-13 17:37:06 -04:00
|
|
|
struct sigevent;
|
2012-03-04 12:36:04 -05:00
|
|
|
|
2012-05-28 16:51:20 -04:00
|
|
|
struct tm
|
|
|
|
{
|
|
|
|
int tm_sec;
|
|
|
|
int tm_min;
|
|
|
|
int tm_hour;
|
|
|
|
int tm_mday;
|
|
|
|
int tm_mon;
|
|
|
|
int tm_year;
|
|
|
|
int tm_wday;
|
2013-01-10 13:45:57 -05:00
|
|
|
int tm_yday;
|
2012-05-28 16:51:20 -04:00
|
|
|
int tm_isdst;
|
|
|
|
};
|
|
|
|
|
2013-10-13 17:37:06 -04:00
|
|
|
__END_DECLS
|
|
|
|
#include <sortix/timespec.h>
|
2013-10-13 17:56:58 -04:00
|
|
|
#include <sortix/itimerspec.h>
|
2014-04-02 15:35:20 -04:00
|
|
|
#if __USE_SORTIX
|
2013-05-15 06:37:39 -04:00
|
|
|
#include <sortix/tmns.h>
|
|
|
|
#endif
|
2013-10-13 17:37:06 -04:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
2013-12-26 19:44:03 -05:00
|
|
|
#ifndef NULL
|
|
|
|
#define __need_NULL
|
|
|
|
#include <stddef.h>
|
|
|
|
#endif
|
2013-10-13 17:37:06 -04:00
|
|
|
|
2013-05-15 09:00:48 -04:00
|
|
|
#define CLOCKS_PER_SEC 1000000l
|
2013-10-13 17:37:06 -04:00
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
#include <sortix/clock.h>
|
2013-10-13 17:56:58 -04:00
|
|
|
#include <sortix/time.h>
|
2013-10-13 17:37:06 -04:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
/* getdate_err is omitted, use strptime */
|
|
|
|
|
2014-09-24 10:20:00 -04:00
|
|
|
#if !defined(__is_sortix_libc) /* not a warning inside libc */
|
|
|
|
__attribute__((__warning__("asctime() is obsolete, use strftime()")))
|
|
|
|
#endif
|
2013-10-13 17:37:06 -04:00
|
|
|
char* asctime(const struct tm*);
|
2014-09-24 10:20:00 -04:00
|
|
|
#if !defined(__is_sortix_libc) /* not a warning inside libc */
|
|
|
|
__attribute__((__warning__("asctime_r() is obsolete, use strftime()")))
|
|
|
|
#endif
|
2013-04-07 11:27:11 -04:00
|
|
|
char* asctime_r(const struct tm* __restrict, char* __restrict);
|
2012-03-04 12:36:04 -05:00
|
|
|
clock_t clock(void);
|
2013-10-13 17:37:06 -04:00
|
|
|
/* TODO: clock_getcpuclockid */
|
|
|
|
int clock_getres(clockid_t, struct timespec*);
|
|
|
|
int clock_gettime(clockid_t, struct timespec*);
|
|
|
|
int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*);
|
|
|
|
int clock_settime(clockid_t, const struct timespec*);
|
2014-09-24 10:20:00 -04:00
|
|
|
#if !defined(__is_sortix_libc) /* not a warning inside libc */
|
|
|
|
__attribute__((__warning__("ctime() is obsolete, use strftime()")))
|
|
|
|
#endif
|
2013-10-13 17:37:06 -04:00
|
|
|
char* ctime(const time_t* clock);
|
2014-09-24 10:20:00 -04:00
|
|
|
#if !defined(__is_sortix_libc) /* not a warning inside libc */
|
|
|
|
__attribute__((__warning__("ctime_r() is obsolete, use strftime()")))
|
|
|
|
#endif
|
2013-10-13 17:37:06 -04:00
|
|
|
char* ctime_r(const time_t* clock, char* buf);
|
|
|
|
double difftime(time_t, time_t);
|
|
|
|
/* getdate is omitted, use strptime */
|
|
|
|
struct tm* gmtime(const time_t*);
|
2013-04-07 11:27:11 -04:00
|
|
|
struct tm* gmtime_r(const time_t* __restrict, struct tm* __restrict);
|
2013-10-13 17:37:06 -04:00
|
|
|
struct tm* localtime(const time_t*);
|
2013-04-07 11:27:11 -04:00
|
|
|
struct tm* localtime_r(const time_t* __restrict, struct tm* __restrict);
|
2013-10-13 17:37:06 -04:00
|
|
|
time_t mktime(struct tm*);
|
|
|
|
int nanosleep(const struct timespec*, struct timespec*);
|
2013-04-07 11:27:11 -04:00
|
|
|
size_t strftime(char* __restrict, size_t, const char* __restrict,
|
|
|
|
const struct tm* __restrict);
|
|
|
|
size_t strftime_l(char* __restrict, size_t, const char* __restrict,
|
|
|
|
const struct tm* __restrict, locale_t);
|
|
|
|
char* strptime(const char* __restrict, const char* __restrict,
|
|
|
|
struct tm* __restrict);
|
2013-10-13 17:37:06 -04:00
|
|
|
time_t time(time_t*);
|
2013-10-13 17:56:58 -04:00
|
|
|
int timer_create(clockid_t, struct sigevent* __restrict, timer_t* __restrict);
|
2013-10-13 17:37:06 -04:00
|
|
|
int timer_delete(timer_t);
|
|
|
|
int timer_getoverrun(timer_t);
|
|
|
|
int timer_gettime(timer_t, struct itimerspec*);
|
2013-04-07 11:27:11 -04:00
|
|
|
int timer_settime(timer_t, int, const struct itimerspec* __restrict,
|
|
|
|
struct itimerspec* __restrict);
|
2013-10-13 17:37:06 -04:00
|
|
|
void tzset(void);
|
|
|
|
|
2013-03-22 21:41:28 -04:00
|
|
|
/* TODO: This is some _MISC_SOURCE thing according to GNU, but I like it. */
|
|
|
|
time_t timegm(struct tm*);
|
2013-05-12 16:10:34 -04:00
|
|
|
|
2014-04-02 15:35:20 -04:00
|
|
|
#if __USE_SORTIX
|
2013-05-12 16:10:34 -04:00
|
|
|
int clock_gettimeres(clockid_t, struct timespec*, struct timespec*);
|
|
|
|
int clock_settimeres(clockid_t, const struct timespec*, const struct timespec*);
|
2013-05-15 06:37:39 -04:00
|
|
|
int timens(struct tmns* tmns);
|
2013-05-12 16:10:34 -04:00
|
|
|
#endif
|
|
|
|
|
2014-02-13 16:06:10 -05:00
|
|
|
extern char* tzname[2];
|
2012-03-04 12:36:04 -05:00
|
|
|
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif
|