//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 13/04/2001 // PROJECT: // SUBSYSTEM: // FILE: Version.cpp // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Source file of Version.cpp //---------------------------------------------------------------------------- #include "stdafx.h" #include "Version.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif SYSTEMTIME CVersion::m_Time = {0,0,0,0,0,0,0,0}; TCHAR CVersion::m_pTime[MAX_PATH]; CVersion::CVersion( LPCTSTR pTime, LPCTSTR pDate ) { LPCTSTR pMonth = "JanFebMarAprMayJunJulAugSepOctNovDec"; SYSTEMTIME st; ::ZeroMemory( &st, sizeof( st ) ); TCHAR pM[MAX_PATH]; _stscanf( pDate, _T("%3s %hu %hu"), pM, &st.wDay, &st.wYear ); st.wMonth = (SHORT)(_tcsstr( pMonth, pM ) - pMonth) / 3 + 1; _stscanf( pTime, _T("%hu:%hu:%hu"), &st.wHour, &st.wMinute, &st.wSecond ); LARGE_INTEGER t1; LARGE_INTEGER t2; FILETIME &ft1 = (FILETIME&)t1; FILETIME &ft2 = (FILETIME&)t2; ::SystemTimeToFileTime( &m_Time, (LPFILETIME)&t1 ); ::SystemTimeToFileTime( &st, (LPFILETIME)&t2 ); if( t2.QuadPart > t1.QuadPart ) { m_Time = st; // int nCount = ::GetDateFormat( GetThreadLocale(), 0UL, &st, "dd'/'MMM'/'yyyy' '", m_pTime, MAX_PATH ); // ::GetTimeFormat( GetThreadLocale(), 0UL, &st, "HH':'mm':'ss", m_pTime + nCount - 1, MAX_PATH - nCount ); int nCount = ::GetTimeFormat( GetThreadLocale(), 0UL, &st, "HH':'mm':'ss' '", m_pTime, MAX_PATH); ::GetDateFormat( GetThreadLocale(), 0UL, &st, "dd' 'MMM' 'yyyy", m_pTime + nCount - 1, MAX_PATH - nCount ); } } CVersion::~CVersion() { }