Move time_t and struct timespec to own header

This commit is contained in:
avdgrinten 2015-12-04 12:08:49 +01:00
parent 3d4d830a3b
commit f1598b2c39
6 changed files with 29 additions and 6 deletions

View file

@ -5,6 +5,7 @@ $c_OBJDIR := $(BUILD_PATH)/$c/obj
$c_HEADERS := assert.h ctype.h errno.h locale.h math.h setjmp.h signal.h stdio.h stdlib.h \
string.h time.h \
mlibc/time_t.h mlibc/timespec.h \
mlibc/ensure.h
$c_OBJECTS := assert.o ctype.o locale.o math.o setjmp.o signal.o stdio.o stdlib.o string.o time.o

View file

@ -0,0 +1,8 @@
#ifndef MLIBC_TIME_T
#define MLIBC_TIME_T
typedef long time_t;
#endif

View file

@ -0,0 +1,11 @@
#ifndef MLIBC_TIMESPEC_H
#define MLIBC_TIMESPEC_H
struct timespec {
time_t tv_sec;
long tv_nsec;
};
#endif // MLIBC_TIMESPEC_H

View file

@ -4,6 +4,8 @@
#include <mlibc/null.h>
#include <mlibc/size_t.h>
#include <mlibc/time_t.h>
#include <mlibc/timespec.h>
#ifdef __cplusplus
extern "C" {
@ -15,13 +17,8 @@ extern "C" {
#define TIME_UTC 1
// TODO: Use an integer type for clock_t?
typedef double clock_t;
typedef double time_t;
struct timespec {
time_t tv_sec;
long tv_nsec;
};
struct tm {
int tm_sec;

View file

@ -11,6 +11,8 @@
#include <mlibc/blksize_t.h>
#include <mlibc/blkcnt_t.h>
#include <mlibc/nlink_t.h>
#include <mlibc/time_t.h>
#include <mlibc/timespec.h>
#define S_IFBLK 0x0000
#define S_IFCHR 0x0100

View file

@ -4,9 +4,11 @@
#include <mlibc/size_t.h>
#include <mlibc/ssize_t.h>
#include <mlibc/uid_t.h>
#include <mlibc/gid_t.h>
#include <mlibc/pid_t.h>
#include <mlibc/mode_t.h>
#include <mlibc/dev_t.h>
#include <mlibc/ino_t.h>
@ -14,6 +16,8 @@
#include <mlibc/blkcnt_t.h>
#include <mlibc/nlink_t.h>
#include <mlibc/time_t.h>
// MISSING: almost every type
#endif // _SYS_TYPES_H