tpTime类
Utils
2025-07-05
介绍
时间类,提供时间相关操作
基础信息
头文件: | include <tpTime.h> |
---|---|
Cmake: | None |
发布版本: | V0.1.0 |
继承类: | |
派生类: |
Public 成员函数
tpTime() | ||
---|---|---|
tpTime(int32_t h, int32_t m, int32_t s, int32_t ms=0) | ||
~tpTime() | ||
hour() const | 获取时间小时值 | |
minute() const | 获取时间分钟值 | |
second() const | 获取时间秒值 | |
msec() const | 获取时间毫秒值 | |
tpString | toString(const tpString &format) const | 将时间对象转换为字符串 |
setHMS(int32_t h, int32_t m, int32_t s, int32_t ms=0) | 设置时间的时分秒毫秒 | |
tpTime tpTime::addSecs | addSecs(int32_t secs) const | 对当前时间添加指定秒数 |
secsTo(const tpTime &t) const | 从当前时间到指定时间的时间间隔 秒 | |
tpTime tpTime::addMSecs | addMSecs(int32_t ms) const | 对当前时间添加指定毫秒数 |
msecsTo(const tpTime &t) const | 从当前时间到指定时间的时间间隔 毫秒 | |
tpTime & tpTime::operator= | operator=(const tpTime &other) noexcept | |
operator==(const tpTime &other) const | ||
operator<(const tpTime &other) const | ||
operator!=(const tpTime &other) const | ||
operator<=(const tpTime &other) const | ||
operator>(const tpTime &other) const | ||
operator>=(const tpTime &other) const | ||
static tpTime tpTime::currentTime | currentTime() | 获取当前时间 |
static tpTime tpTime::fromString | fromString(const tpString &s, const tpString &format) | 将时间字符串转换为时间对象 |
成员函数说明
tpTime::tpTime()
暂无注释...
tpTime::tpTime(int32_t h, int32_t m, int32_t s, int32_t ms=0)
暂无注释...
tpTime::~tpTime()
暂无注释...
int32_t tpTime::hour() const
点击查看...
获取时间小时值
返回值:
小时
int32_t tpTime::minute() const
点击查看...
获取时间分钟值
返回值:
分钟
int32_t tpTime::second() const
点击查看...
获取时间秒值
返回值:
秒
int32_t tpTime::msec() const
点击查看...
获取时间毫秒值
返回值:
毫秒
tpString tpTime::toString(const tpString &format) const
点击查看...
将时间对象转换为字符串
返回值:
时间字符串
bool tpTime::setHMS(int32_t h, int32_t m, int32_t s, int32_t ms=0)
点击查看...
设置时间的时分秒毫秒
返回值:
返回设置结果;如果时间取值错误,则返回false
tpTime tpTime::addSecs(int32_t secs) const
点击查看...
对当前时间添加指定秒数
返回值:
返回添加指定秒数后的事件对象
int32_t tpTime::secsTo(const tpTime &t) const
点击查看...
从当前时间到指定时间的时间间隔 秒
返回值:
指定时间在当前时间之后为正,反之为负值
tpTime tpTime::addMSecs(int32_t ms) const
点击查看...
对当前时间添加指定毫秒数
返回值:
返回添加指定毫秒数后的事件对象
int32_t tpTime::msecsTo(const tpTime &t) const
点击查看...
从当前时间到指定时间的时间间隔 毫秒
返回值:
指定时间在当前时间之后为正,反之为负值
tpTime & tpTime::operator=(const tpTime &other) noexcept
暂无注释...
bool tpTime::operator==(const tpTime &other) const
暂无注释...
bool tpTime::operator<(const tpTime &other) const
暂无注释...
bool tpTime::operator!=(const tpTime &other) const
暂无注释...
bool tpTime::operator<=(const tpTime &other) const
暂无注释...
bool tpTime::operator>(const tpTime &other) const
暂无注释...
bool tpTime::operator>=(const tpTime &other) const
暂无注释...
static tpTime tpTime::currentTime()
点击查看...
获取当前时间
返回值:
事件对象
static tpTime tpTime::fromString(const tpString &s, const tpString &format)
点击查看...
将时间字符串转换为时间对象
返回值:
时间对象