mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 22:31:23 +01:00
Timestamp reference point ambiguity #614
This commit is contained in:
parent
6b84bbcadb
commit
6ddce4c9ff
@ -45,11 +45,14 @@ class Foundation_API Clock
|
||||
/// to the time of day.
|
||||
{
|
||||
public:
|
||||
typedef Int64 ClockVal; /// monotonic clock value in microsecond resolution
|
||||
typedef Int64 ClockDiff; /// difference between two clock values in microseconds
|
||||
typedef Int64 ClockVal;
|
||||
/// Monotonic clock value in microsecond resolution.
|
||||
|
||||
static const ClockVal CLOCKVAL_MIN; /// minimum clock value
|
||||
static const ClockVal CLOCKVAL_MAX; /// maximum clock value
|
||||
typedef Int64 ClockDiff;
|
||||
/// Difference between two ClockVal values in microseconds.
|
||||
|
||||
static const ClockVal CLOCKVAL_MIN; /// Minimum clock value.
|
||||
static const ClockVal CLOCKVAL_MAX; /// Maximum clock value.
|
||||
|
||||
Clock();
|
||||
/// Creates a Clock with the current system clock value.
|
||||
@ -81,7 +84,7 @@ public:
|
||||
|
||||
Clock operator + (ClockDiff d) const;
|
||||
Clock operator - (ClockDiff d) const;
|
||||
ClockDiff operator - (const Clock& ts) const;
|
||||
ClockDiff operator - (const Clock& ts) const;
|
||||
Clock& operator += (ClockDiff d);
|
||||
Clock& operator -= (ClockDiff d);
|
||||
|
||||
@ -105,12 +108,12 @@ public:
|
||||
/// Returns true iff the given interval has passed
|
||||
/// since the time denoted by the Clock instance.
|
||||
|
||||
static ClockVal resolution();
|
||||
static ClockDiff resolution();
|
||||
/// Returns the resolution in units per second.
|
||||
/// Since the Clock clas has microsecond resolution,
|
||||
/// the returned value is always 1000000.
|
||||
|
||||
static ClockVal accuracy();
|
||||
static ClockDiff accuracy();
|
||||
/// Returns the system's clock accuracy in microseconds.
|
||||
|
||||
static bool monotonic();
|
||||
@ -213,7 +216,7 @@ inline bool Clock::isElapsed(Clock::ClockDiff interval) const
|
||||
}
|
||||
|
||||
|
||||
inline Clock::ClockVal Clock::resolution()
|
||||
inline Clock::ClockDiff Clock::resolution()
|
||||
{
|
||||
return 1000000;
|
||||
}
|
||||
|
@ -37,25 +37,37 @@ class Foundation_API Timestamp
|
||||
///
|
||||
/// [*] Note that Timestamp values are only monotonic as
|
||||
/// long as the systems's clock is monotonic as well
|
||||
/// (and not, e.g. set back).
|
||||
/// (and not, e.g. set back due to time synchronization
|
||||
/// or other reasons).
|
||||
///
|
||||
/// Timestamps are UTC (Coordinated Universal Time)
|
||||
/// based and thus independent of the timezone
|
||||
/// in effect on the system.
|
||||
///
|
||||
/// The internal reference time is the Unix epoch,
|
||||
/// midnight, January 1, 1970.
|
||||
{
|
||||
public:
|
||||
typedef Int64 TimeVal; /// monotonic UTC time value in microsecond resolution
|
||||
typedef Int64 UtcTimeVal; /// monotonic UTC time value in 100 nanosecond resolution
|
||||
typedef Int64 TimeDiff; /// difference between two timestamps in microseconds
|
||||
typedef Int64 TimeVal;
|
||||
/// Monotonic UTC time value in microsecond resolution,
|
||||
/// with base time midnight, January 1, 1970.
|
||||
|
||||
typedef Int64 UtcTimeVal;
|
||||
/// Monotonic UTC time value in 100 nanosecond resolution,
|
||||
/// with base time midnight, October 15, 1582.
|
||||
|
||||
typedef Int64 TimeDiff;
|
||||
/// Difference between two TimeVal values in microseconds.
|
||||
|
||||
static const TimeVal TIMEVAL_MIN; /// minimum timestamp value
|
||||
static const TimeVal TIMEVAL_MAX; /// maximum timestamp value
|
||||
static const TimeVal TIMEVAL_MIN; /// Minimum timestamp value.
|
||||
static const TimeVal TIMEVAL_MAX; /// Maximum timestamp value.
|
||||
|
||||
Timestamp();
|
||||
/// Creates a timestamp with the current time.
|
||||
|
||||
Timestamp(TimeVal tv);
|
||||
/// Creates a timestamp from the given time value.
|
||||
/// Creates a timestamp from the given time value
|
||||
/// (microseconds since midnight, January 1, 1970).
|
||||
|
||||
Timestamp(const Timestamp& other);
|
||||
/// Copy constructor.
|
||||
@ -120,9 +132,11 @@ public:
|
||||
/// Creates a timestamp from a std::time_t.
|
||||
|
||||
static Timestamp fromUtcTime(UtcTimeVal val);
|
||||
/// Creates a timestamp from a UTC time value.
|
||||
/// Creates a timestamp from a UTC time value
|
||||
/// (100 nanosecond intervals since midnight,
|
||||
/// October 15, 1582).
|
||||
|
||||
static TimeVal resolution();
|
||||
static TimeDiff resolution();
|
||||
/// Returns the resolution in units per second.
|
||||
/// Since the timestamp has microsecond resolution,
|
||||
/// the returned value is always 1000000.
|
||||
@ -241,7 +255,7 @@ inline bool Timestamp::isElapsed(Timestamp::TimeDiff interval) const
|
||||
}
|
||||
|
||||
|
||||
inline Timestamp::TimeVal Timestamp::resolution()
|
||||
inline Timestamp::TimeDiff Timestamp::resolution()
|
||||
{
|
||||
return 1000000;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void Clock::update()
|
||||
}
|
||||
|
||||
|
||||
Clock::ClockVal Clock::accuracy()
|
||||
Clock::ClockDiff Clock::accuracy()
|
||||
{
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user