Testing monotonic clock

Matthew Dillon dillon at apollo.backplane.com
Mon Apr 7 07:44:47 PDT 2008


:Matthew Dillon wrote:
:> I would say that DragonFly is wrong.  The opengroup standards page
:> says that only <time.h> is needed.
:
:OK. so, how could we fix this? Any objections to just add include to 
:<sys/time.h> into time.h? It fixes the problem problem for sure, but I'm 
:not sure about all consequences - this myriad of ifdefs etc 
:in /usr/include has been always mystery for me ;).
:
:-- 
:Hasso Tepper

    Well, sys/time.h includes sys/types.h and quite a bit of work seems
    to have gone into restricting visibility so we might need to do a
    little work on sys/time.h before we can include it in time.h

    It looks like time.h only needs sys/types.h in order to get time_t.
    time_t's real declaration is __time_t from <machine/types.h>
    (which in turn comes from cpu/*/include/stdint.h).  Whew, what a
    mouthful.

    What that means is that I think <time.h> could do something like
    this (untested):

	#include <machine/types.h>

	#ifndef _TIME_T_DECLARED
	#define _TIME_T_DECLARED
	typedef __time_t        time_t;
	#endif

    Instead of including sys/types.h.  Then you could include sys/time.h from
    time.h.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Kernel mailing list