Subject: Re: Timer roll over in microtime()
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 07/19/2006 16:16:43
In article <20060719160453.53742.qmail@web38415.mail.mud.yahoo.com>,
blue horn  <neelgusano@yahoo.com> wrote:
>Hi, 
>  I am experiencing timer rollover in my code.
>  
>
>   struct timeval    now; 
>   microtime(&now);
>   printf ("\n Process: [%d] Time:[%ld]",
>                p->p_pid,
>                now.tv_sec*100000 + now.tv_usec);
>
> Output of vr/log/message file:
> 05:47:42: Process:[13] Time:[2145071681]
> 05:48:13  Process:[13] Time:[-2146785080] 
> 05:48:13  Process:[13] Time:[-2146785080]
>

I don't understand what you mean by "timer rollover". This is just
arithmetic overflow. Using quad arithmetic fixes it, but I am not
sure what you are trying to do...

   printf ("\n Process: [%d] Time:[%lld]",
                p->p_pid,
                now.tv_sec*100000LL + now.tv_usec);

christos