本文整理汇总了C++中CDateTime::SetMonth方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::SetMonth方法的具体用法?C++ CDateTime::SetMonth怎么用?C++ CDateTime::SetMonth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::SetMonth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFileTime
/*
GetFileTime()
Ricava la data/ora UTC del file (assolute, in formato GMT). Se il secondo parametro e' TRUE,
converte da GMT a local time, aggiungendo o sottraendo la differenza oraria rispetto a GMT:
- data/ora assolute del file (UTC=GMT): Sun, 06 Nov 1994 08:49:37 GMT (0000)
- zona oraria locale: GMT +1 (+0100)
bConvertToLocalTime = FALSE -> Sun, 06 Nov 1994 08:49:37 GMT
bConvertToLocalTime = TRUE -> Sun, 06 Nov 1994 09:49:37 +0100
*/
BOOL CBinFile::GetFileTime(CDateTime& datetime,BOOL bConvertToLocalTime/* = FALSE*/)
{
BOOL bGet = FALSE;
if(m_hHandle!=INVALID_HANDLE_VALUE)
{
FILETIME gmtfiletime = {0};
FILETIME filetime = {0};
SYSTEMTIME systemtime = {0};
// ricava la data/ora UTC del file (ossia assolute, GMT)
if(::GetFileTime(m_hHandle,NULL,NULL,&gmtfiletime))
{
if(bConvertToLocalTime)
::FileTimeToLocalFileTime(&gmtfiletime,&filetime); // converte in locale (aggiunge o sottrae la differenza rispetto a GMT)
else
memcpy(&filetime,&gmtfiletime,sizeof(FILETIME)); // nessuna conversione, data/ora assolute (UTC)
// converte in formato di sistema
::FileTimeToSystemTime(&filetime,&systemtime);
// formatta la data/ora del file (Day, dd Mon yyyy hh:mm:ss [GMT])
datetime.SetDateFormat(bConvertToLocalTime ? GMT : GMT_SHORT);
datetime.SetYear(systemtime.wYear);
datetime.SetMonth(systemtime.wMonth);
datetime.SetDay(systemtime.wDay);
datetime.SetHour(systemtime.wHour);
datetime.SetMin(systemtime.wMinute);
datetime.SetSec(systemtime.wSecond);
bGet = TRUE;
}
}
return(bGet);
}
示例2: Update
/*
Update()
*/
BOOL CUrlDatabaseService::Update( LPCSTR lpcszUrl,
LPCSTR lpcszEndTime,
double dlTotalTime,
double dlDownloadTime,
CUrlStatus::URL_STATUS nStat,
UINT nID,
LPCSTR lpcszReportName,
CUrlTable* pHttptable
)
{
BOOL bInserted = FALSE;
if(m_bIsValid)
{
// sincronizza gli accessi
if(m_pUrlDatabaseTable->Lock(SYNC_5_SECS_TIMEOUT))
{
strcpyn(m_szUrl,lpcszUrl,sizeof(m_szUrl));
// scorre il database per ricavare i totali
double dlTotBytes = 0.0f;
UINT nUrls = 0;
UINT nDownloadedUrls = 0;
UINT nDownloadedItems = 0;
UINT nTotalPict = 0;
if(pHttptable)
{
pHttptable->SetIndex(URL_IDX_ID);
if(pHttptable->GoTop())
{
do
{
pHttptable->ScatterMemvars();
nUrls++;
if((CUrlStatus::URL_STATUS)pHttptable->GetField_Stat()==CUrlStatus::URL_STATUS_DOWNLOADED)
{
nDownloadedUrls++;
dlTotBytes += pHttptable->GetField_Size();
}
m_Url.SplitUrl(pHttptable->GetField_Url(),&m_stUrl);
if(CImage::IsImageFile(m_stUrl.file) || CImage::IsImageFile(m_stUrl.cgi))
{
nTotalPict++;
if((CUrlStatus::URL_STATUS)pHttptable->GetField_Stat()==CUrlStatus::URL_STATUS_DOWNLOADED)
nDownloadedItems++;
}
pHttptable->GetNext();
} while(!pHttptable->Eof());
}
}
CDateTime* pDate = NULL;
CDateTime* pTime = NULL;
CDateTime Date;
CDateTime Time;
CString cData = "";
BOOL bFound = FALSE;
if(m_pUrlDatabaseTable->Seek(m_szUrl,URLDATABASE_IDX_URL))
{
m_pUrlDatabaseTable->ScatterMemvars();
pDate = m_pUrlDatabaseTable->GetField_Date();
pTime = m_pUrlDatabaseTable->GetField_StartTime();
Date.SetYear(pDate->GetYear());
Date.SetMonth(pDate->GetMonth());
Date.SetDay(pDate->GetDay());
Time.SetHour(pTime->GetHour());
Time.SetMin(pTime->GetMin());
Time.SetSec(pTime->GetSec());
cData = m_pUrlDatabaseTable->GetField_DataTable();
m_pUrlDatabaseTable->Delete();
bFound = TRUE;
}
if(bFound)
{
m_pUrlDatabaseTable->ResetMemvars();
m_pUrlDatabaseTable->PutField_Url ( m_szUrl );
m_pUrlDatabaseTable->PutField_Date ( &Date );
m_pUrlDatabaseTable->PutField_StartTime ( &Time );
m_DateTime.ConvertTime(HHMMSS_GMT,HHMMSS,lpcszEndTime,NULL);
m_pUrlDatabaseTable->PutField_EndTime ( &m_DateTime );
m_pUrlDatabaseTable->PutField_TotalTime ( dlTotalTime );
m_pUrlDatabaseTable->PutField_DownloadTime ( dlDownloadTime );
m_pUrlDatabaseTable->PutField_Downloaded ( dlTotBytes );
m_pUrlDatabaseTable->PutField_TotalUrls ( nUrls );
//.........这里部分代码省略.........