You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
/**
|
|
* @file TimeUtility.h
|
|
* @brief 常用时间函数
|
|
* @author 沙漠乌鸦
|
|
* @time 2009-10-20
|
|
*/
|
|
#pragma once
|
|
|
|
class AFX_EXT_CLASS CTimeUtility
|
|
{
|
|
public:
|
|
CTimeUtility(void);
|
|
~CTimeUtility(void);
|
|
|
|
/** @brief 获取时间标记 */
|
|
static ULONGLONG GetTimeStamp();
|
|
/**
|
|
* @brief 获取时间标记字符串
|
|
* @return 返回格式为2009-10-08 10:20:48
|
|
*/
|
|
static CString GetTimeStampStr();
|
|
|
|
static int GetAbsoluteDay(SYSTEMTIME time); // 返回time是从公元1年1月1日算起的第多少天,如0001-01-01为第一天
|
|
|
|
static SYSTEMTIME GetTimeOfAbsoluteDay(int day); // day是从公元1年1月1日算起的第多少天,如0001-01-01为第一天
|
|
|
|
static int GetAbsoluteYear(SYSTEMTIME time);
|
|
static int GetAbsoluteMonth(SYSTEMTIME time);
|
|
static int GetDaysOfYear(int iYear);
|
|
static int GetDaysOfMonth(int iYear,int iMonth);
|
|
|
|
static SYSTEMTIME TimeAddDays(SYSTEMTIME time,int day); ///< 获取从当前日期增加若干天后的日期
|
|
static SYSTEMTIME TimeSubDays(SYSTEMTIME time,int day); ///< 获取从当前日期减少若干天后的日期
|
|
|
|
static int TimeSpanDays(SYSTEMTIME t0,SYSTEMTIME t1);
|
|
static int TimeSpanYears(SYSTEMTIME t0,SYSTEMTIME t1);
|
|
static int TimeSpanMonths(SYSTEMTIME t0,SYSTEMTIME t1);
|
|
|
|
private:
|
|
static ULONGLONG m_gUllTime;
|
|
static UINT m_nIncrease;
|
|
};
|