mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Added ftime(), as contributed by Peter Bengtsson. Thank you very much!
- Added the missing S_ISSOCKET() macro to <sys/stat.h>. Note that this is not actually a POSIX feature. - Added fmin(), fminf(), fmax() and fmaxf() to the build makefiles. Somehow I must have forgotten about them :-( git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15105 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.68k,v 1.85 2006-05-04 08:01:45 obarthel Exp $
|
||||
# $Id: GNUmakefile.68k,v 1.86 2006-07-28 13:19:11 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -515,6 +515,7 @@ UNIX_LIB = \
|
||||
termios_tcgetattr.o \
|
||||
termios_tcsendbreak.o \
|
||||
termios_tcsetattr.o \
|
||||
timeb_ftime.o \
|
||||
uio_readv.o \
|
||||
uio_writev.o \
|
||||
unistd_access.o \
|
||||
@ -606,6 +607,10 @@ MATH_LIB = \
|
||||
math_floorf.o \
|
||||
math_fma.o \
|
||||
math_fmaf.o \
|
||||
math_fmax.o \
|
||||
math_fmaxf.o \
|
||||
math_fmin.o \
|
||||
math_fminf.o \
|
||||
math_fmod.o \
|
||||
math_fmodf.o \
|
||||
math_fpclassify.o \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.os4,v 1.98 2006-06-22 09:02:44 obarthel Exp $
|
||||
# $Id: GNUmakefile.os4,v 1.99 2006-07-28 13:19:11 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -558,6 +558,7 @@ UNIX_LIB = \
|
||||
termios_tcgetattr.o \
|
||||
termios_tcsendbreak.o \
|
||||
termios_tcsetattr.o \
|
||||
timeb_ftime.o \
|
||||
uio_readv.o \
|
||||
uio_writev.o \
|
||||
unistd_access.o \
|
||||
@ -650,6 +651,10 @@ MATH_LIB = \
|
||||
math_floorf.o \
|
||||
math_fma.o \
|
||||
math_fmaf.o \
|
||||
math_fmax.o \
|
||||
math_fmaxf.o \
|
||||
math_fmin.o \
|
||||
math_fminf.o \
|
||||
math_fmod.o \
|
||||
math_fmodf.o \
|
||||
math_fpclassify.o \
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
- Added ftime(), as contributed by Peter Bengtsson. Thank you very much!
|
||||
|
||||
- Added the missing S_ISSOCKET() macro to <sys/stat.h>. Note that this
|
||||
is not actually a POSIX feature.
|
||||
|
||||
- Added fmin(), fminf(), fmax() and fmaxf() to the build makefiles.
|
||||
Somehow I must have forgotten about them :-(
|
||||
|
||||
- select() and waitselect() can now be called without any file descriptor
|
||||
sets to work with, as some software does which uses select() in place
|
||||
of sleep().
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat.h,v 1.9 2006-01-08 12:06:14 obarthel Exp $
|
||||
* $Id: stat.h,v 1.10 2006-07-28 13:19:12 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -112,6 +112,7 @@ extern "C" {
|
||||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* symbolic link */
|
||||
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo */
|
||||
#define S_ISBLK(m) (0) /* block special */
|
||||
#define S_ISSOCK(m) (((m) & S_IFSOCK) == S_IFSOCK) /* socket */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
66
library/include/sys/timeb.h
Normal file
66
library/include/sys/timeb.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* $Id: timeb.h,v 1.1 2006-07-28 13:19:12 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************
|
||||
*
|
||||
* Documentation and source code for this library, and the most recent library
|
||||
* build are available from <http://sourceforge.net/projects/clib2>.
|
||||
*
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TIMEB_H
|
||||
#define _SYS_TIMEB_H
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _TIME_H
|
||||
#include <time.h> /* For the definition of time_t */
|
||||
#endif /* _TIME_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct timeb
|
||||
{
|
||||
time_t time;
|
||||
unsigned short millitm;
|
||||
short timezone;
|
||||
short dstflag;
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern int ftime(struct timeb *);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _SYS_TIMEB_H */
|
||||
74
library/timeb_ftime.c
Normal file
74
library/timeb_ftime.c
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* $Id: timeb_ftime.c,v 1.1 2006-07-28 13:19:11 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/timeb.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
ftime(struct timeb *tb)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
int retval = -1;
|
||||
|
||||
ENTER();
|
||||
|
||||
if(tb == NULL)
|
||||
{
|
||||
__set_errno(EFAULT);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(gettimeofday(&tv,&tz) != 0)
|
||||
goto out;
|
||||
|
||||
tb->time = tv.tv_sec;
|
||||
tb->millitm = tv.tv_usec / 1000;
|
||||
tb->timezone = tz.tz_minuteswest;
|
||||
tb->dstflag = tz.tz_dsttime;
|
||||
|
||||
retval = 0;
|
||||
|
||||
out:
|
||||
|
||||
RETURN(retval);
|
||||
return(retval);
|
||||
}
|
||||
Reference in New Issue
Block a user