libc/newlib/libc/include/sys/timeb.h

41 lines
800 B
C
Raw Normal View History

2000-02-17 20:39:52 +01:00
/* timeb.h -- An implementation of the standard Unix <sys/timeb.h> file.
Written by Ian Lance Taylor <ian@cygnus.com>
Public domain; no rights reserved.
<sys/timeb.h> declares the structure used by the ftime function, as
well as the ftime function itself. Newlib does not provide an
implementation of ftime. */
#ifndef _SYS_TIMEB_H
#ifdef __cplusplus
extern "C" {
#endif
#define _SYS_TIMEB_H
#include <_ansi.h>
Eliminate use of Newlib-specific <machine/types.h> This change solves a glibc/BSD compatibility problem. glibc and BSD use double underscore types for internal types. The Linux port of Newlib uses some glibc provided internal type definitions which are not protected by guard defines, e.g. __off_t. To avoid a conflict Newlib uses single underscore types for some internal types, e.g. _off_t. However, for BSD compatibility we have to define the internal types with double underscore names in <sys/_types.h>. The header file <machine/types.h> is Newlib-specific. It was used instead of <sys/_types.h> to provide the internal type definitions _CLOCK_T, _TIME_T_, _CLOCKID_T_, _TIMER_T_, and __suseconds_t. Move these definitions to <sys/_types.h> (there exist two instances of this file, one for Linux and one for all other targets). This makes the _HAVE_SYSTYPES configuration define obsolete (could possibly break the __RDOS__ target). Use the standard <sys/_types.h> include throughout. Move __loff_t defintion to default (non-Linux) <sys/_types.h>. Define it via _off64_t to avoid a dependency on the compiler. Provide the __off_t definition via default (non-Linux) <sys/_types.h> based on _off_t for all systems except Cygwin. For Cygwin use _off64_t. Define off_t via __off_t. Provide the __pid_t definition via default (non-Linux) <sys/_types.h>. This prevents a potential __pid_t and pid_t incompatibility. Add BSD guard defines for pid_t. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-13 13:10:15 +02:00
#include <sys/_types.h>
2000-02-17 20:39:52 +01:00
#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
typedef _TIME_T_ time_t;
#define __time_t_defined
#define _TIME_T_DECLARED
2000-02-17 20:39:52 +01:00
#endif
struct timeb
{
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
extern int ftime (struct timeb *);
2000-02-17 20:39:52 +01:00
#ifdef __cplusplus
}
#endif
#endif /* ! defined (_SYS_TIMEB_H) */