设为首页 加入收藏

TOP

POCO C++库学习和分析 -- 日期与时间 (二)
2014-11-24 03:20:57 】 浏览:1132
Tags:POCO 学习 分析 --日期 时间
e() const;
/// Returns the timestamp expressed in time_t.
/// time_t base time is midnight, January 1, 1970.
/// Resolution is one second.

UtcTimeva l utcTime() const;
/// Returns the timestamp expressed in UTC-based
/// time. UTC base time is midnight, October 15, 1582.
/// Resolution is 100 nanoseconds.

Timeva l epochMicroseconds() const;
/// Returns the timestamp expressed in microseconds
/// since the Unix epoch, midnight, January 1, 1970.

TimeDiff elapsed() const;
/// Returns the time elapsed since the time denoted by
/// the timestamp. Equivalent to Timestamp() - *this.

bool isElapsed(TimeDiff interval) const;
/// Returns true iff the given interval has passed
/// since the time denoted by the timestamp.

static Timestamp fromEpochTime(std::time_t t);
/// Creates a timestamp from a std::time_t.

static Timestamp fromUtcTime(UtcTimeva l val);
/// Creates a timestamp from a UTC time value.

static Timeva l resolution();
/// Returns the resolution in units per second.
/// Since the timestamp has microsecond resolution,
/// the returned value is always 1000000.

private:
Timeva l _ts;
};

class Foundation_API Timestamp
{
public:
typedef Int64 Timeva l; /// monotonic UTC time value in microsecond resolution
typedef Int64 UtcTimeva l; /// monotonic UTC time value in 100 nanosecond resolution
typedef Int64 TimeDiff; /// difference between two timestamps in microseconds

Timestamp();
/// Creates a timestamp with the current time.

Timestamp(Timeva l tv);
/// Creates a timestamp from the given time value.

Timestamp(const Timestamp& other);
/// Copy constructor.

~Timestamp();
/// Destroys the timestamp

Timestamp& operator = (const Timestamp& other);
Timestamp& operator = (Timeva l tv);

void swap(Timestamp& timestamp);
/// Swaps the Timestamp with another one.

void update();
/// Updates the Timestamp with the current time.


bool operator == (const Timestamp& ts) const;
bool operator != (const Timestamp& ts) const;
bool operator > (const Timestamp& ts) const;
bool operator >= (const Timestamp& ts) const;
bool operator < (const Timestamp& ts) const;
bool operator <= (const Timestamp& ts) const;

Timestamp operator + (TimeDiff d) const;
Timestamp operator - (TimeDiff d) const;
TimeDiff operator - (const Timestamp& ts) const;
Timestamp& operator += (TimeDiff d);
Timestamp& operator -= (TimeDiff d);

std::time_t epochTime() const;
/// Returns the timestamp expressed in time_t.
/// time_t base time is midnight, January 1, 1970.
/// Resolution is one second.

UtcTimeva l utcTime() const;
/// Returns the timestamp expressed in UTC-based
/// time. UTC base time is midnight, October 15, 1582.
/// Resolution is 100 nanoseconds.

Timeva l epochMicroseconds() const;
/// Returns the timestamp expressed in microseconds
/// since the Unix epoch, midnight, January 1, 1970.

TimeDiff elapsed() const;
/// Returns the time elapsed since the time denoted by
/// the timestamp. Equivalent to Timestamp() - *this.

bool isElapsed(TimeDiff interval) const;
/// Returns true iff the given interval has passed
/// since the time denoted by the timestamp.

static Timestamp fromEpochTime(std::time_t t);
/// Creates a timestamp from a std::time_t.

static Timestamp fromUtcTime

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/12/12
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇fzu 2035 Axial symmetry(几何) 下一篇BZOJ 2565 最长双回文串

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目