diff --git a/libmaxsi/decl/suseconds_t.h b/libmaxsi/decl/suseconds_t.h new file mode 100644 index 00000000..ecb8d261 --- /dev/null +++ b/libmaxsi/decl/suseconds_t.h @@ -0,0 +1,4 @@ +#ifndef _SUSECONDS_T_DECL +#define _SUSECONDS_T_DECL +typedef __suseconds_t suseconds_t; +#endif diff --git a/libmaxsi/decl/time_t.h b/libmaxsi/decl/time_t.h new file mode 100644 index 00000000..5aae828b --- /dev/null +++ b/libmaxsi/decl/time_t.h @@ -0,0 +1,4 @@ +#ifndef _TIME_T_DECL +#define _TIME_T_DECL +typedef __time_t time_t; +#endif diff --git a/libmaxsi/include/sys/time.h b/libmaxsi/include/sys/time.h new file mode 100644 index 00000000..5d87a1ec --- /dev/null +++ b/libmaxsi/include/sys/time.h @@ -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 . + + sys/time.h + Time types. + +******************************************************************************/ + +#ifndef _SYS_TIME_H +#define _SYS_TIME_H 1 + +#include + +__BEGIN_DECLS + +@include(time_t.h) +@include(suseconds_t.h) + +__END_DECLS + +#include + +__BEGIN_DECLS + +int gettimeofday(struct timeval* restrict tp, void* restrict tzp); + +__END_DECLS + +#endif diff --git a/libmaxsi/time.cpp b/libmaxsi/time.cpp index fd2e7b4e..5045fdd9 100644 --- a/libmaxsi/time.cpp +++ b/libmaxsi/time.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include 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; + } } } diff --git a/sortix/timeval.h b/sortix/timeval.h new file mode 100644 index 00000000..2e91239d --- /dev/null +++ b/sortix/timeval.h @@ -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 . + + timeval.h + Declares the struct timeval. + +*******************************************************************************/ + +#ifndef SORTIX_TIMEVAL_H +#define SORTIX_TIMEVAL_H + +#include + +__BEGIN_DECLS + +struct timeval +{ + time_t tv_sec; + suseconds_t tv_usec; +}; + +__END_DECLS + +#endif + diff --git a/sortix/x64/bits.h b/sortix/x64/bits.h index 6ad8705c..df8e0dbb 100644 --- a/sortix/x64/bits.h +++ b/sortix/x64/bits.h @@ -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 diff --git a/sortix/x86/bits.h b/sortix/x86/bits.h index 504d4a24..3de65073 100644 --- a/sortix/x86/bits.h +++ b/sortix/x86/bits.h @@ -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