Add timeradd() and timersub() to <sys/time.h>. [PSARC/2008/368 FastTrack timeout 06/16/2008]

Bart Smaalders bart.smaalders at sun.com
Mon Jun 9 11:34:50 PDT 2008


Dan McDonald wrote:
> 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?
> 

There just isn't any good way around this w/ std C, so we'll have to live
w/ the accidental side effects problems.

If the lint fix is critical, you can change the definition of the macro when
using lint to use a non-constant conditional...

- Bart




-- 
Bart Smaalders			Solaris Kernel Performance
barts at cyber.eng.sun.com		http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."



More information about the opensolaris-arc mailing list