Added <time.h>, clock_t, and a stub for clock(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2012-03-04 18:36:04 +01:00
parent 0bd6a4ff67
commit 777fc04682
6 changed files with 53 additions and 0 deletions

4
libmaxsi/decl/clock_t.h Normal file
View File

@ -0,0 +1,4 @@
#ifndef _CLOCK_T_DECL
#define _CLOCK_T_DECL
typedef __clock_t clock_t;
#endif

View File

@ -33,6 +33,7 @@ __BEGIN_DECLS
@include(useconds_t.h)
@include(pid_t.h)
@include(clock_t.h)
__END_DECLS

38
libmaxsi/include/time.h Normal file
View File

@ -0,0 +1,38 @@
/******************************************************************************
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/>.
time.h
Time declarations.
******************************************************************************/
#ifndef _TIME_H
#define _TIME_H 1
#include <features.h>
__BEGIN_DECLS
@include(clock_t.h)
clock_t clock(void);
__END_DECLS
#endif

View File

@ -26,6 +26,8 @@
#include <libmaxsi/string.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/syscall.h>
#include <errno.h>
#include <time.h>
namespace Maxsi
{
@ -37,5 +39,11 @@ namespace Maxsi
{
return SysUptime(usecssinceboot);
}
extern "C" clock_t clock(void)
{
errno = ENOTSUP;
return -1;
}
}
}

View File

@ -130,6 +130,7 @@ typedef __off_t __blkcnt_t;
typedef unsigned int __nlink_t;
typedef __uintmax_t __ino_t;
typedef __uintptr_t __dev_t;
typedef __intmax_t __clock_t;
#endif

View File

@ -130,6 +130,7 @@ typedef __off_t __blkcnt_t;
typedef unsigned int __nlink_t;
typedef __uintmax_t __ino_t;
typedef __uintptr_t __dev_t;
typedef __intmax_t __clock_t;
#endif