Link to home
Start Free TrialLog in
Avatar of Risky101
Risky101Flag for United States of America

asked on

difftime() seems to have a resolution of 1 second - anything more accurate?

Hi,

Difftime seems to have a resolution of 1 second, ie:

                              //
                              // Profiling: output time since last operation
                              //
                              {
                                    time(&profiling_now);
                                    time_t td;
                                    td=difftime(profiling_now, profiling_then);
                                    td=(float)td;
                                    my_fprintf_VL7(stderr,"[t2=%2.3fs]",td);
                                    time(&profiling_then);
                              }

... prints  things like [t2=1.000s] or [t2=3.000s].

Any calls in the Linux 2.6 kernel that can get a resolution down to 1/100 of a second? This excludes driver calls - this is an application.

Shane.
ASKER CERTIFIED SOLUTION
Avatar of brettmjohnson
brettmjohnson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of scn
scn

The macro timersub defined in sys/time.h performs substractions of timeval structure variables