soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
STime Class Reference

时间类 More...

#include <STime.h>

Public Member Functions

 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
 格式化时间字符串
 
STimeoperator= (__time64_t time)
 赋值运算符重载
 
STimeoperator+= (STimeSpan span)
 加法赋值运算符重载
 
STimeoperator-= (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
 大于等于运算符重载
 

Static Public Member Functions

static STime GetCurrentTime ()
 获取当前时间
 
static uint64_t GetCurrentTimeMs ()
 获取当前时间的毫秒数
 

Protected Attributes

time_t m_time
 

Detailed Description

时间类

Definition at line 160 of file STime.h.

Constructor & Destructor Documentation

◆ STime() [1/2]

STime::STime ( __time64_t tm = 0)
inline

默认构造函数

Parameters
tm时间秒数(默认为0)

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.

Member Function Documentation

◆ Format()

SStringT STime::Format ( LPCTSTR pszFormat) const

格式化时间字符串

Parameters
pszFormat格式字符串
Returns
格式化后的时间字符串

Definition at line 320 of file stime.cpp.

◆ GetAsSystemTime()

bool STime::GetAsSystemTime ( SYSTEMTIME & timeDest) const

获取系统时间结构

Parameters
timeDest系统时间结构引用
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

获取日

Returns

Definition at line 224 of file stime.cpp.

◆ GetDayOfWeek()

int STime::GetDayOfWeek ( ) const

获取星期几

Returns
星期几(0=星期日,1=星期一,...,6=星期六)

Definition at line 248 of file stime.cpp.

◆ GetHour()

int STime::GetHour ( ) const

获取小时

Returns
小时

Definition at line 230 of file stime.cpp.

◆ GetLocalTm()

struct tm * STime::GetLocalTm ( struct tm * ptm) const

获取本地时间结构

Parameters
ptm本地时间结构指针
Returns
本地时间结构指针

Definition at line 141 of file stime.cpp.

◆ GetMinute()

int STime::GetMinute ( ) const

获取分钟

Returns
分钟

Definition at line 236 of file stime.cpp.

◆ GetMonth()

int STime::GetMonth ( ) const

获取月份

Returns
月份

Definition at line 218 of file stime.cpp.

◆ GetSecond()

int STime::GetSecond ( ) const

获取秒

Returns

Definition at line 242 of file stime.cpp.

◆ GetTime()

__time64_t STime::GetTime ( ) const

获取时间秒数

Returns
时间秒数

Definition at line 207 of file stime.cpp.

◆ GetYear()

int STime::GetYear ( ) const

获取年份

Returns
年份

Definition at line 212 of file stime.cpp.

◆ operator!=()

bool STime::operator!= ( STime time) const

不等于运算符重载

Parameters
time时间对象
Returns
如果不相等返回true,否则返回false

Definition at line 266 of file stime.cpp.

◆ operator+()

STime STime::operator+ ( STimeSpan span) const

加法运算符重载

Parameters
span时间间隔对象
Returns
新的时间对象

Definition at line 315 of file stime.cpp.

◆ operator+=()

STime & STime::operator+= ( STimeSpan span)

加法赋值运算符重载

Parameters
span时间间隔对象
Returns
当前时间对象的引用

Definition at line 291 of file stime.cpp.

◆ operator-() [1/2]

STimeSpan STime::operator- ( STime time) const

减法运算符重载

Parameters
time时间对象
Returns
时间间隔对象

Definition at line 305 of file stime.cpp.

◆ operator-() [2/2]

STime STime::operator- ( STimeSpan span) const

减法运算符重载

Parameters
span时间间隔对象
Returns
新的时间对象

Definition at line 310 of file stime.cpp.

◆ operator-=()

STime & STime::operator-= ( STimeSpan span)

减法赋值运算符重载

Parameters
span时间间隔对象
Returns
当前时间对象的引用

Definition at line 298 of file stime.cpp.

◆ operator<()

bool STime::operator< ( STime time) const

小于运算符重载

Parameters
time时间对象
Returns
如果小于返回true,否则返回false

Definition at line 271 of file stime.cpp.

◆ operator<=()

bool STime::operator<= ( STime time) const

小于等于运算符重载

Parameters
time时间对象
Returns
如果小于等于返回true,否则返回false

Definition at line 281 of file stime.cpp.

◆ operator=()

STime & STime::operator= ( __time64_t time)

赋值运算符重载

Parameters
time时间秒数
Returns
当前时间对象的引用

Definition at line 254 of file stime.cpp.

◆ operator==()

bool STime::operator== ( STime time) const

等于运算符重载

Parameters
time时间对象
Returns
如果相等返回true,否则返回false

Definition at line 261 of file stime.cpp.

◆ operator>()

bool STime::operator> ( STime time) const

大于运算符重载

Parameters
time时间对象
Returns
如果大于返回true,否则返回false

Definition at line 276 of file stime.cpp.

◆ operator>=()

bool STime::operator>= ( STime time) const

大于等于运算符重载

Parameters
time时间对象
Returns
如果大于等于返回true,否则返回false

Definition at line 286 of file stime.cpp.

◆ SetDate()

void STime::SetDate ( int nYear,
int nMonth,
int nDay )

设置日期

Parameters
nYear年份
nMonth月份
nDay

Definition at line 136 of file stime.cpp.

◆ 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.

Member Data Documentation

◆ m_time

time_t STime::m_time
protected

Definition at line 369 of file STime.h.


The documentation for this class was generated from the following files: