autoconf-patches
[Top][All Lists]
Advanced

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

gettimeofday macro (was Re: A macro to check for data type alignment)


From: Peter Eisentraut
Subject: gettimeofday macro (was Re: A macro to check for data type alignment)
Date: Wed, 13 Feb 2002 11:41:01 -0500 (EST)

(I should add that the subject line is bogus.  I wanted to send the
alignment check macro in another email.)

> | Here is a macro that checks whether the gettimeofday() function takes only
> | 1 argument (normal is 2, the second argument is the time zone).  This is
> | the case on some SVR4 systems.  If this is found to be the case, the macro
> | inserts of definition
> |
> | #define gettimeofday(a,b) gettimeofday(a)
> |
> | into config.h.  Thus gettimezone can be used consistently throughout the
> | code without changes.  (The use of the second argument is obsolete on
> | modern systems, so there are not real problems to be expected from
> | ignoring it.)
>
> Thanks for the contribution!
>
> I'm somewhat against using AC_DEFINE to replace functions (but until
> we can provide more convenient, I'll just shut up 1:), and against
> AC_FUNC which replaces without saying.  Please, submit an
> AC_REPLACE_FUNC_GETTIMEOFDAY.
>
> Since there appears to be some debate about it, I'd like Paul's
> insight on this function.  In particular, I shall repeat I don't like
> AC_DEFINE here.  It seems to me that AC_REPLACE_FUNC is appropriate
> here, with a real implementation of the POSIX guy.

The problem is that there's no such "POSIX guy".  I don't know the exact
history (Paul probably does ;-) ), but this is what I can tell:

* On old BSD systems, gettimeofday(a, b) returned the time in a and the
time zone in b.

* On old SVr4 systems, gettimeofday(a) returned the time.  (You get the
time zone some other way.)

* On most modern systems (including, e.g., glibc/Linux and FreeBSD), the
prototype is gettimeofday(a, b), but b is simply ignored.

So the consequence is that no modern program can expect the second
argument to do anything useful.  So a replacement isn't of real utility.
The only thing you really need is to fix the prototype for some old
systems.

Maybe you need a third class of macros, AC_FIX_FUNC. ;-)

-- 
Peter Eisentraut   address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]