Boost logo

Boost :

From: (noreply_at_[hidden])
Date: 2006-07-11 07:41:56

Bugs item #1520489, was opened at 2006-07-11 15:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: timer
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Sukhonosenko Kirill (skv)
Assigned to: Beman Dawes (beman_dawes)
Summary: significantly different timer class behaviour on Win and Lin

Initial Comment:
clock() function used in implementation of
boost::timer behaves differently on Windows (MS XP
Pro, MSVC 7.1) and Linux (FC3, gcc 3.4.2).

Windows: clock measures elapsed time (wall clock).
And this comply with boost::timer interface

boost::timer t;
double sec = 1;
double d = t.elapsed();
assert(abs(d-sec) < 0.1);

Linux: clock() function returnes process CPU time.
The above code will fail.

This difference makes boost::timer a bad candidate
for cross-platform development. I can propose
alternative implementation with simalar right


#include <time.h>

namespace Timer
        Measures intervals of wall clock time, but
not process CPU time. Resolution & accuracy depends
on time function abilities.
        class timer
                // setup reference time point

                // reset reference time point
                void restart()

                // report difference between current
time and reference point
                double elapsed() const
                        time_t curr_time;
                        double diff = difftime
(curr_time, m_ref_time);
                        return diff;

        // forbidden
                timer(const timer &);
                timer & operator=(const timer &);

                time_t m_ref_time;

} // namespace Timer

#endif //_Timer_h_dlfkgh9384ytdflg9045uhy0823475mgd385


You can respond by visiting:

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Boost-bugs mailing list

Boost list run by bdawes at, gregod at, cpdaniel at, john at