On Mon, Jun 09, 2008 at 11:16:55AM -0700, Bart Smaalders wrote:
> #define timerclear(t) { struct timeval *a = (t); a->tv_sec = a->tv_usec = 0; 
> }
>
> seems to be a reasonable fix.

Until you do something like:

        if (foo)
                timerclear(&t);  /* XXX KEBE SAYS SYNTAX ERROR */
        else
                something_else();

I thought we were trying to not be different than the rest of the world now?

> As above:
>
> #define timeradd(i1, i2, o1)                            \
> { struct timeval *a = i1, *b = i2, *result = o1;        \
>   result->tv_sec = a->tv_sec + b->tv_sec;               \
>   result->tv_usec = a->tv_usec + b->tv_usec;            \
>   if (result->tv_usec >= 1000000) {                     \
>         ++result->tv_sec;                               \
>         result->tv_usec -= 1000000;                      \
>   }                                                     \
> }

Again, I'm trying to be bug-for-bug-compatible with the world so we don't
violate the principle of least-surprise.

Dan

Reply via email to