[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#145857: libc6-dev: three problems in <time.h>



At Tue, 11 Mar 2003 13:42:48 -0800,
Jeff Breidenbach wrote:
> The sample code now works in 2.3.1-14. Great!
> 
> > #include <time.h>
> > #include <sched.h>
> >
> > main () {
> >   return 0;
> > }
> >
> > gcc -o testcase -ansi -Werror testcase.c
> 
> There still appears to be at least one bug in <time.h>.
> If I have __need_clockid_t defined, why does <time.h>
> define _TIME_H ?
>
> In other words, why is __need_clockid_t treated differently
> from   __need_time_t, __need_clock_t and  __need_timespec ?

I think checking __need_clockid_t (and __need_timer_t, so on)
is less meaning compared with __need_clock_t, __need_timespec.

For example, look at select.h, sys/types.h.

    sys/types.h:

	#ifdef __USE_XOPEN
	# define __need_clock_t <-
	#endif
	#define __need_time_t	<-
	#define __need_timer_t
	#define __need_clockid_t
	#include <time.h>	<-

    select.h:

	#define __need_time_t	<-
	#define __need_timespec	<-
	#include <time.h>	<-
	#define __need_timeval
	#include <bits/time.h>

    time.h:

	#if (! defined __need_time_t && !defined __need_clock_t && \
	     ! defined __need_timespec)
	# define _TIME_H        1
	# include <features.h>

Regards,
-- gotom





Reply to: