mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added <sys/time.h>, struct timeval and gettimeofday(3) stub.
This commit is contained in:
parent
e006687645
commit
c0a02248da
7 changed files with 106 additions and 0 deletions
4
libmaxsi/decl/suseconds_t.h
Normal file
4
libmaxsi/decl/suseconds_t.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#ifndef _SUSECONDS_T_DECL
|
||||
#define _SUSECONDS_T_DECL
|
||||
typedef __suseconds_t suseconds_t;
|
||||
#endif
|
4
libmaxsi/decl/time_t.h
Normal file
4
libmaxsi/decl/time_t.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#ifndef _TIME_T_DECL
|
||||
#define _TIME_T_DECL
|
||||
typedef __time_t time_t;
|
||||
#endif
|
45
libmaxsi/include/sys/time.h
Normal file
45
libmaxsi/include/sys/time.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/******************************************************************************
|
||||
|
||||
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
|
||||
|
||||
This file is part of LibMaxsi.
|
||||
|
||||
LibMaxsi 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.
|
||||
|
||||
LibMaxsi 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.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
sys/time.h
|
||||
Time types.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _SYS_TIME_H
|
||||
#define _SYS_TIME_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@include(time_t.h)
|
||||
@include(suseconds_t.h)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#include <sortix/timeval.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int gettimeofday(struct timeval* restrict tp, void* restrict tzp);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
|
@ -27,6 +27,7 @@
|
|||
#include <libmaxsi/memory.h>
|
||||
#include <libmaxsi/syscall.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
namespace Maxsi
|
||||
|
@ -45,5 +46,12 @@ namespace Maxsi
|
|||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" int gettimeofday(struct timeval* tp, void* /*tzp*/)
|
||||
{
|
||||
tp->tv_sec = 0;
|
||||
tp->tv_usec = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
41
sortix/timeval.h
Normal file
41
sortix/timeval.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*******************************************************************************
|
||||
|
||||
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2012.
|
||||
|
||||
This file is part of Sortix.
|
||||
|
||||
Sortix is free software: you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
Sortix 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 General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
Sortix. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
timeval.h
|
||||
Declares the struct timeval.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef SORTIX_TIMEVAL_H
|
||||
#define SORTIX_TIMEVAL_H
|
||||
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
struct timeval
|
||||
{
|
||||
time_t tv_sec;
|
||||
suseconds_t tv_usec;
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
@ -131,6 +131,8 @@ typedef unsigned int __nlink_t;
|
|||
typedef __uintmax_t __ino_t;
|
||||
typedef __uintptr_t __dev_t;
|
||||
typedef __intmax_t __clock_t;
|
||||
typedef long __time_t;
|
||||
typedef long __suseconds_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -131,6 +131,8 @@ typedef unsigned int __nlink_t;
|
|||
typedef __uintmax_t __ino_t;
|
||||
typedef __uintptr_t __dev_t;
|
||||
typedef __intmax_t __clock_t;
|
||||
typedef long __time_t;
|
||||
typedef long __suseconds_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue