时间类
More...
#include <STime.h>
|
| | STime (__time64_t tm=0) |
| | 默认构造函数
|
| |
| | STime (int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST=-1) |
| | 构造函数,从年、月、日、时、分、秒初始化
|
| |
| void | SetDate (int nYear, int nMonth, int nDay) |
| | 设置日期
|
| |
| void | SetDateTime (int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST=-1) |
| | 设置日期和时间
|
| |
| __time64_t | GetTime () const |
| | 获取时间秒数
|
| |
| struct tm * | GetLocalTm (struct tm *ptm) const |
| | 获取本地时间结构
|
| |
| bool | GetAsSystemTime (SYSTEMTIME &timeDest) const |
| | 获取系统时间结构
|
| |
| int | GetYear () const |
| | 获取年份
|
| |
| int | GetMonth () const |
| | 获取月份
|
| |
| int | GetDay () const |
| | 获取日
|
| |
| int | GetHour () const |
| | 获取小时
|
| |
| int | GetMinute () const |
| | 获取分钟
|
| |
| int | GetSecond () const |
| | 获取秒
|
| |
| int | GetDayOfWeek () const |
| | 获取星期几
|
| |
| SStringT | Format (LPCTSTR pszFormat) const |
| | 格式化时间字符串
|
| |
| STime & | operator= (__time64_t time) |
| | 赋值运算符重载
|
| |
| STime & | operator+= (STimeSpan span) |
| | 加法赋值运算符重载
|
| |
| STime & | operator-= (STimeSpan span) |
| | 减法赋值运算符重载
|
| |
| STimeSpan | operator- (STime time) const |
| | 减法运算符重载
|
| |
| STime | operator- (STimeSpan span) const |
| | 减法运算符重载
|
| |
| STime | operator+ (STimeSpan span) const |
| | 加法运算符重载
|
| |
| bool | operator== (STime time) const |
| | 等于运算符重载
|
| |
| bool | operator!= (STime time) const |
| | 不等于运算符重载
|
| |
| bool | operator< (STime time) const |
| | 小于运算符重载
|
| |
| bool | operator> (STime time) const |
| | 大于运算符重载
|
| |
| bool | operator<= (STime time) const |
| | 小于等于运算符重载
|
| |
| bool | operator>= (STime time) const |
| | 大于等于运算符重载
|
| |
时间类
Definition at line 160 of file STime.h.
◆ STime() [1/2]
| STime::STime |
( |
__time64_t | tm = 0 | ) |
|
|
inline |
默认构造函数
- Parameters
-
Definition at line 178 of file STime.h.
◆ STime() [2/2]
| STime::STime |
( |
int | nYear, |
|
|
int | nMonth, |
|
|
int | nDay, |
|
|
int | nHour, |
|
|
int | nMin, |
|
|
int | nSec, |
|
|
int | nDST = -1 ) |
构造函数,从年、月、日、时、分、秒初始化
- Parameters
-
| nYear | 年份 |
| nMonth | 月份 |
| nDay | 日 |
| nHour | 小时 |
| nMin | 分钟 |
| nSec | 秒 |
| nDST | 夏令时标志(默认为-1,表示自动检测) |
Definition at line 116 of file stime.cpp.
◆ Format()
| SStringT STime::Format |
( |
LPCTSTR | pszFormat | ) |
const |
格式化时间字符串
- Parameters
-
- Returns
- 格式化后的时间字符串
Definition at line 320 of file stime.cpp.
◆ GetAsSystemTime()
| bool STime::GetAsSystemTime |
( |
SYSTEMTIME & | timeDest | ) |
const |
获取系统时间结构
- Parameters
-
- Returns
- 如果成功返回true,否则返回false
Definition at line 160 of file stime.cpp.
◆ GetCurrentTime()
| STime STime::GetCurrentTime |
( |
| ) |
|
|
static |
获取当前时间
- Returns
- 当前时间对象
Definition at line 184 of file stime.cpp.
◆ GetCurrentTimeMs()
| uint64_t STime::GetCurrentTimeMs |
( |
| ) |
|
|
static |
获取当前时间的毫秒数
- Returns
- 当前时间的毫秒数
Definition at line 189 of file stime.cpp.
◆ GetDay()
| int STime::GetDay |
( |
| ) |
const |
◆ GetDayOfWeek()
| int STime::GetDayOfWeek |
( |
| ) |
const |
获取星期几
- Returns
- 星期几(0=星期日,1=星期一,...,6=星期六)
Definition at line 248 of file stime.cpp.
◆ GetHour()
| int STime::GetHour |
( |
| ) |
const |
◆ GetLocalTm()
| struct tm * STime::GetLocalTm |
( |
struct tm * | ptm | ) |
const |
获取本地时间结构
- Parameters
-
- Returns
- 本地时间结构指针
Definition at line 141 of file stime.cpp.
◆ GetMinute()
| int STime::GetMinute |
( |
| ) |
const |
◆ GetMonth()
| int STime::GetMonth |
( |
| ) |
const |
◆ GetSecond()
| int STime::GetSecond |
( |
| ) |
const |
◆ GetTime()
| __time64_t STime::GetTime |
( |
| ) |
const |
获取时间秒数
- Returns
- 时间秒数
Definition at line 207 of file stime.cpp.
◆ GetYear()
| int STime::GetYear |
( |
| ) |
const |
◆ operator!=()
| bool STime::operator!= |
( |
STime | time | ) |
const |
不等于运算符重载
- Parameters
-
- Returns
- 如果不相等返回true,否则返回false
Definition at line 266 of file stime.cpp.
◆ operator+()
加法运算符重载
- Parameters
-
- Returns
- 新的时间对象
Definition at line 315 of file stime.cpp.
◆ operator+=()
加法赋值运算符重载
- Parameters
-
- Returns
- 当前时间对象的引用
Definition at line 291 of file stime.cpp.
◆ operator-() [1/2]
减法运算符重载
- Parameters
-
- Returns
- 时间间隔对象
Definition at line 305 of file stime.cpp.
◆ operator-() [2/2]
减法运算符重载
- Parameters
-
- Returns
- 新的时间对象
Definition at line 310 of file stime.cpp.
◆ operator-=()
减法赋值运算符重载
- Parameters
-
- Returns
- 当前时间对象的引用
Definition at line 298 of file stime.cpp.
◆ operator<()
| bool STime::operator< |
( |
STime | time | ) |
const |
小于运算符重载
- Parameters
-
- Returns
- 如果小于返回true,否则返回false
Definition at line 271 of file stime.cpp.
◆ operator<=()
| bool STime::operator<= |
( |
STime | time | ) |
const |
小于等于运算符重载
- Parameters
-
- Returns
- 如果小于等于返回true,否则返回false
Definition at line 281 of file stime.cpp.
◆ operator=()
| STime & STime::operator= |
( |
__time64_t | time | ) |
|
赋值运算符重载
- Parameters
-
- Returns
- 当前时间对象的引用
Definition at line 254 of file stime.cpp.
◆ operator==()
| bool STime::operator== |
( |
STime | time | ) |
const |
等于运算符重载
- Parameters
-
- Returns
- 如果相等返回true,否则返回false
Definition at line 261 of file stime.cpp.
◆ operator>()
| bool STime::operator> |
( |
STime | time | ) |
const |
大于运算符重载
- Parameters
-
- Returns
- 如果大于返回true,否则返回false
Definition at line 276 of file stime.cpp.
◆ operator>=()
| bool STime::operator>= |
( |
STime | time | ) |
const |
大于等于运算符重载
- Parameters
-
- Returns
- 如果大于等于返回true,否则返回false
Definition at line 286 of file stime.cpp.
◆ SetDate()
| void STime::SetDate |
( |
int | nYear, |
|
|
int | nMonth, |
|
|
int | nDay ) |
◆ SetDateTime()
| void STime::SetDateTime |
( |
int | nYear, |
|
|
int | nMonth, |
|
|
int | nDay, |
|
|
int | nHour, |
|
|
int | nMin, |
|
|
int | nSec, |
|
|
int | nDST = -1 ) |
设置日期和时间
- Parameters
-
| nYear | 年份 |
| nMonth | 月份 |
| nDay | 日 |
| nHour | 小时 |
| nMin | 分钟 |
| nSec | 秒 |
| nDST | 夏令时标志(默认为-1,表示自动检测) |
Definition at line 121 of file stime.cpp.
◆ m_time
The documentation for this class was generated from the following files: