In message: <[EMAIL PROTECTED]>
            Jan Knepper <[EMAIL PROTECTED]> writes:
: How would they return me the 'value' of 'ticks'?
: 
: The problem is... I have a value's somewhere that has been assigned from 
: 'ticks', like:
: ptr -> value   = ticks;
: 
: at an other moment I need to do something like...
: 
: age   = boottime + ( ticks - ptr -> value ) / factor;
: 
: The problem in the second case however is that I can not seem to get to 
: 'ticks' as it is userland code...

ptr->value should be set with getmicrotime() or microtime().  You can
then do a gettimeofday in userland to figure out the age.

MICROTIME(9)           FreeBSD Kernel Developer's Manual          MICROTIME(9)

NAME
     microtime, getmicrotime, nanotime, getnanotime - get the current time

SYNOPSIS
     #include <sys/time.h>

     void
     microtime(struct timeval *tv);

     void
     getmicrotime(struct timeval *tv);

     void
     nanotime(struct timespec *ts);

     void
     getnanotime(struct timespec *tsp);

DESCRIPTION
     The microtime() and getmicrotime() functions store the system time as a
     struct timeval at the address specified by tv.  The nanotime() and
     getnanotime() functions perform the same utility, but record the time as
     a struct timespec instead.

     Microtime() and nanotime() always query the timecounter to return the
     current time as precisely as possible.  Whereas getmicrotime() and
     getnanotime() functions are abstractions which return a less precise, but
     faster to obtain, time.

     The intent of the getmicrotime() and getnanotime() functions is to
     enforce the user's preference for timer accuracy versus execution time.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to