Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-10-29 12:53:23


Jeff Garland:

>> Now I also understand better the sentence that appear in N2320 in all
>> timed functions: "ElapsedTime shall be explicitly convertible to
>> nanoseconds". It's because nanoseconds are the basic for all. Now lets
>
> I'll check, but that's incorrect and has been removed. They don't need to
> be
> convertible to nanoseconds, they need to provide get_count and a
> ticks_per_second trait to allow conversion to the system time resolution.

This strikes me as overgeneralization (speaking strictly of the
thread-related portions of the standard). I don't quite see why

struct std::abstime: public timespec
{
// constructors...
};

struct std::reltime: public timespec
{
// constructors...
};

// overloaded operators, a way to obtain the system time...

isn't enough. POSIX uses timespec and Windows uses milliseconds.

> Yes, it will, but the time duration type provides all the machinery to
> support
> the needed rounding. Frankly rounding will be the majority of the cases
> if
> you use nanoseconds because few systems currently have clock support at
> that
> resolution.

POSIX systems use nanoseconds in the interface. timespec is

struct timespec
{
    time_t tv_sec;
    long tv_nsec;
};

or to be precise, its definition is:

"The <time.h> header shall declare the structure timespec, which has at
least the following members:

time_t tv_sec Seconds.
long tv_nsec Nanoseconds."


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk