----------------------------------------------------------------------------------------
COleDateTime now = COleDateTime::GetCurrentTime();
int a = now.GetMinute();
현재 시각이 1:27분이라면 27 정수를 리턴한다.
60초 체크하기
dwTimeStart = ::GetTickCount();
dwTimeEnd = dwTimeStart + 60000; // 60초마다 체크
while (::GetTickCount() < dwTimeEnd)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
Sleep(1);
}
----------------------------------------------------------------------------------------
COleDateTime now;
now = COleDateTime::GetTickCount();
CString strFileName;
strFileName.Format(_T("HashLog_%04d%02d%02d_%02d%02d%02d.txt"), now.GetYear(), now.GetMonth(),
now.GetDay(), now.GetHour(), now.GetMinute(), now.GetSecond());
----------------------------------------------------------------------------------------
이런 식으로 사용이 가능함
ATL/MFC에서 사용 주로 사용하는 시간 클래스
그런데 GetCurrentTIme쓰면 댄다는데 왜 VS2008에서 객체에서 ::했는데 안나오길래 GetTickCount() 사용했었는데...
그리고 두 COleDateTime 객체간의 차이를 구할 때는
----------------------------------------------------------------------------------------
COleDateTime ATime(2007, 4, 26, 17, 20, 30);
COleDateTime BTime(2007, 4, 26, 18, 20, 50);
COleDateTimeSpan C = BTime - ATime;
C.GetTotalDays() - 차이나는 총 날짜
C.GetTotalHours() - 차이나는 총 시간
C.GetTotalMinutes() - 차이나는 총 분
C.GetTotalSeconds() - 차이나는 총 초
----------------------------------------------------------------------------------------
객채를 생성할 때에는 아래와 같이 초기화하면서 사용 가능함
가장 일반적으로는 COleDateTime( nYear, nMonth, nDay, nHour, nMin, nSec ) 이게 많이 쓰이겠지..
----------------------------------------------------------------------------------------
COleDateTime( ) Constructs a COleDateTime object initialized to 0 (midnight, 30 December 1899).
COleDateTime( dateSrc ) Constructs a COleDateTime object from an existing COleDateTime object.
COleDateTime( varSrc ) Constructs a COleDateTime object. Attempts to convert a VARIANT structure or COleVariant object to a date/time (VT_DATE) value. If this conversion is successful, the converted value is copied into the new COleDateTime object. If it is not, the value of the COleDateTime object is set to 0 (midnight, 30 December 1899) and its status to invalid.
COleDateTime( dtSrc ) Constructs a COleDateTime object from a DATE value.
COleDateTime( timeSrc ) Constructs a COleDateTime object from a time_t value.
COleDateTime( systimeSrc ) Constructs a COleDateTime object from a SYSTEMTIME value.
COleDateTime( filetimeSrc ) Constructs a COleDateTime object from a FILETIME value. . Note that FILETIME uses Universal Coordinated Time (UTC), so if you pass a local time in the structure, your results will be incorrect. See File Times in the Platform SDK for more information.
COleDateTime( nYear, nMonth, nDay, nHour, nMin, nSec ) Constructs a COleDateTime object from the specified numerical values.
COleDateTime( wDosDate, wDosTime ) Constructs a COleDateTime object from the specified MS-DOS date and time values.
----------------------------------------------------------------------------------------
%a Abbreviated weekday name
- %A Full weekday name
- %b Abbreviated month name
- %B Full month name
- %c Date and time representation appropriate for locale
- %d Day of month as decimal number (01 – 31)
- %H Hour in 24-hour format (00 – 23)
- %I Hour in 12-hour format (01 – 12)
- %j Day of year as decimal number (001 – 366)
- %m Month as decimal number (01 – 12)
- %M Minute as decimal number (00 – 59)
- %p Current locale's A.M./P.M. indicator for 12-hour clock
- %S Second as decimal number (00 – 59)
- %U Week of year as decimal number, with Sunday as first day of week (00 – 53)
- %w Weekday as decimal number (0 – 6; Sunday is 0)
- %W Week of year as decimal number, with Monday as first day of week (00 – 53)
- %x Date representation for current locale
- %X Time representation for current locale
- %y Year without century, as decimal number (00 – 99)
- %Y Year with century, as decimal number
- %z, %Z Either the time-zone name or time zone abbreviation, depending on registry settings; no characters if time zone is unknown
- %% Percent sign
----------------------------------------------------------------------------------------
라고 http://kgpark.net/tools/19 에 나와있었음...
클래스 멤버 변수는 아래 링크 참조
http://msdn.microsoft.com/en-us/library/by5d3kb1%28VS.80%29.aspx