boost.png (6897 bytes) Home Libraries People FAQ More

PrevUpHomeNext

Struct xtime

boost::xtime —

An object of type xtime defines a time that is used to perform high-resolution time operations. This is a temporary solution that will be replaced by a more robust time library once available in Boost.

Synopsis

struct xtime {

  platform-specific-type sec;
};

// creation
int xtime_get(xtime*, int);

Description

The xtime type is used to represent a point on some time scale or a duration in time. This type may be proposed for the C standard by Markus Kuhn. Boost.Threads provides only a very minimal implementation of this proposal; it is expected that a full implementation (or some other time library) will be provided in Boost as a separate library, at which time Boost.Threads will deprecate its own implementation.

Note that the resolution is implementation specific. For many implementations the best resolution of time is far more than one nanosecond, and even when the resolution is reasonably good, the latency of a call to xtime_get() may be significant. For maximum portability, avoid durations of less than one second.

xtime creation

  1. int xtime_get(xtime* xtp, int clock_type);

    Postconditions: xtp represents the current point in time as a duration since the epoch specified by clock_type.
    Returns: clock_type if successful, otherwise 0.

Copyright © 2001-2003 William E. Kempf

PrevUpHomeNext