mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add <time.h> header forward declarations.
Note that many of the functions are not yet implemented.
This commit is contained in:
parent
dbc6c8c663
commit
8162011b5d
6 changed files with 73 additions and 24 deletions
4
libc/decl/timer_t.h
Normal file
4
libc/decl/timer_t.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#ifndef _TIMER_T_DECL
|
||||
#define _TIMER_T_DECL
|
||||
typedef __timer_t timer_t;
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
|
@ -22,26 +22,22 @@
|
|||
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _TIME_H
|
||||
#define _TIME_H 1
|
||||
#ifndef INCLUDE_TIME_H
|
||||
#define INCLUDE_TIME_H
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@include(clock_t.h)
|
||||
@include(clockid_t.h)
|
||||
@include(size_t.h)
|
||||
@include(pid_t.h)
|
||||
@include(time_t.h)
|
||||
@include(NULL.h)
|
||||
@include(clockid_t.h)
|
||||
@include(timer_t.h)
|
||||
@include(locale_t.h)
|
||||
@include(pid_t.h)
|
||||
|
||||
__END_DECLS
|
||||
#include <sortix/clock.h>
|
||||
#include <sortix/timespec.h>
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define CLOCKS_PER_SEC 1000000
|
||||
struct sigevent;
|
||||
|
||||
struct tm
|
||||
{
|
||||
|
@ -56,22 +52,66 @@ struct tm
|
|||
int tm_isdst;
|
||||
};
|
||||
|
||||
struct utimbuf
|
||||
__END_DECLS
|
||||
#include <sortix/timespec.h>
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* TODO: This itimer stuff is replaced with another interface IIRC. */
|
||||
struct itimerspec
|
||||
{
|
||||
time_t actime;
|
||||
time_t modtime;
|
||||
struct timespec it_interval;
|
||||
struct timespec it_value;
|
||||
};
|
||||
|
||||
@include(NULL.h)
|
||||
|
||||
#define CLOCKS_PER_SEC ((clock_t) 1000000)
|
||||
|
||||
__END_DECLS
|
||||
#include <sortix/clock.h>
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define TIMER_ABSTIME (1<<0)
|
||||
|
||||
/* getdate_err is omitted, use strptime */
|
||||
|
||||
char* asctime(const struct tm*);
|
||||
char* asctime_r(const struct tm* restrict, char* restrict);
|
||||
clock_t clock(void);
|
||||
time_t time(time_t* t);
|
||||
char* ctime(const time_t* timep);
|
||||
struct tm* localtime_r(const time_t* timer, struct tm* ret);
|
||||
struct tm* gmtime_r(const time_t* timer, struct tm* ret);
|
||||
#if !defined(_SORTIX_SOURCE)
|
||||
struct tm* localtime(const time_t* timer);
|
||||
struct tm* gmtime(const time_t* timer);
|
||||
#endif
|
||||
int utime(const char* filepath, const struct utimbuf* times);
|
||||
/* 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*);
|
||||
char* ctime(const time_t* clock);
|
||||
char* ctime_r(const time_t* clock, char* buf);
|
||||
/* ctime_r is obsolescent */
|
||||
double difftime(time_t, time_t);
|
||||
/* getdate is omitted, use strptime */
|
||||
struct tm* gmtime(const time_t*);
|
||||
struct tm* gmtime_r(const time_t* restrict, struct tm* restrict);
|
||||
struct tm* localtime(const time_t*);
|
||||
struct tm* localtime_r(const time_t* restrict, struct tm* restrict);
|
||||
time_t mktime(struct tm*);
|
||||
int nanosleep(const struct timespec*, struct timespec*);
|
||||
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);
|
||||
time_t time(time_t*);
|
||||
int timer_create(clockid_t, struct sigevent* restrict, time_t* restrict);
|
||||
int timer_delete(timer_t);
|
||||
int timer_getoverrun(timer_t);
|
||||
int timer_gettime(timer_t, struct itimerspec*);
|
||||
int timer_settime(timer_t, int, const struct itimerspec* restrict,
|
||||
struct itimerspec* restrict);
|
||||
void tzset(void);
|
||||
|
||||
extern int daylight;
|
||||
extern long timezone;
|
||||
extern char* tzname[];
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ typedef long int __ssize_t;
|
|||
#else
|
||||
typedef int __ssize_t;
|
||||
#endif
|
||||
typedef void* __timer_t;
|
||||
|
||||
#if defined(SORTIX_KERNEL) || defined(LIBC_LIBRARY)
|
||||
#define OFF_MIN __OFF_MIN
|
||||
|
|
|
@ -33,6 +33,8 @@ __BEGIN_DECLS
|
|||
#define CLOCK_MONOTONIC 1 /* Always increasing time. */
|
||||
#define CLOCK_BOOT 2 /* Time since system boot (uptime). */
|
||||
#define CLOCK_INIT 3 /* Time since 'init' process began. */
|
||||
#define CLOCK_PROCESS_CPUTIME_ID 4
|
||||
#define CLOCK_THREAD_CPUTIME_ID 5
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -151,5 +151,6 @@ typedef __intmax_t __clock_t;
|
|||
typedef int __clockid_t;
|
||||
typedef long __time_t;
|
||||
typedef long __suseconds_t;
|
||||
typedef void* __timer_t;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -151,5 +151,6 @@ typedef __intmax_t __clock_t;
|
|||
typedef int __clockid_t;
|
||||
typedef long __time_t;
|
||||
typedef long __suseconds_t;
|
||||
typedef void* __timer_t;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue