[Asterisk-Dev] Re: ast_localtime() weird interface.

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Oct 12 13:40:26 MST 2005


On Wednesday 12 October 2005 15:08, alex at pilosoft.com wrote:
> On Wed, 12 Oct 2005, Tilghman Lesher wrote:
> > That may be true, but until FreeBSD made this 64-bit conversion,
> > every system has managed this fine.  Given that Rizzo is a FreeBSD
> > developer, he is in a unique position to make sure that FreeBSD
> > does the right thing and fixes this issue that appears to be unique
> > to FreeBSD.
>
> That's a silly attitude. You have two different APIs, some mandated
> by SUS (Single Unix System, aka OSF aka Unix Group) some are
> inherited back from 4BSD, etc. You expect both of them to have same
> datatype. That's unreasonable. Best you can hope for is that one of
> them will be available.

int gettimeofday(struct timeval *tv, struct timezone *tz);
struct timeval {
               time_t         tv_sec;        /* seconds */
               suseconds_t    tv_usec;  /* microseconds */
       };

struct tm *localtime(const time_t *timep);

Hey, look, both are time_t in size.  Gee, I wonder, maybe that means
they're BOTH THE SAME SIZE.

And maybe that also means that if FreeBSD has them different sizes, then
FREEBSD IS BROKEN.

And since you brought up the Single Unix Specification, let me quote
from the STANDARD:

	The <sys/time.h> header shall define the timeval structure that
	includes at least the following members:
	time_t         tv_sec      Seconds.
	suseconds_t    tv_usec     Microseconds. 

That should be clear enough for everybody that FreeBSD is non-compliant.

> Just because it works on your linux box, does not mean that software
> that expects to be portable can assume that.
>
> > We can't be held hostage to dumb design decisions on alternative
> > platforms.
>
> I think to everyone reading the list, it is fairly clear what is
> dumb...

You mean people who don't actually read the documentation?  I agree.

-- 
Tilghman



More information about the asterisk-dev mailing list