本文整理汇总了C++中CDate::SetDateNow方法的典型用法代码示例。如果您正苦于以下问题:C++ CDate::SetDateNow方法的具体用法?C++ CDate::SetDateNow怎么用?C++ CDate::SetDateNow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDate
的用法示例。
在下文中一共展示了CDate::SetDateNow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StoreCriteriaValueDatetime
//----------------------------------------
void CSelectionCriteriaDlg::StoreCriteriaValueDatetime(CProduct* product, bool checkDefault /* = true */)
{
if (product == NULL)
{
return;
}
if (!product->HasDatetimeCriteria())
{
return;
}
CCriteriaDatetime* criteria = product->GetDatetimeCriteria();
criteria->SetDefaultValue();
double defaultValue;
CTools::SetDefaultValue(defaultValue);
CDate dateMin;
CDate dateMax;
double min = 0.0;
double max = 0.0;
dateMin.InitDateZero();
dateMax.SetDateNow();
/*
CDate dateMin;
CDate dateMax;
dateMin.SetDefaultValue();
dateMax.SetDefaultValue();
GetCritDateMin()->GetValue(dateMin, defaultValue);
GetCritDateMax()->GetValue(dateMax, defaultValue);
*/
//GetCritDateMin()->GetValueAsDate(min, defaultValue, dateMin.Value(), dateMax.Value());
//GetCritDateMax()->GetValueAsDate(max, defaultValue, dateMin.Value(), dateMax.Value());
GetCritDateMin()->GetValueAsDate(min, defaultValue);
GetCritDateMax()->GetValueAsDate(max, defaultValue);
// to set right date string format
GetCritDateMin()->SetValueAsDate(min, "");
GetCritDateMax()->SetValueAsDate(max, "");
criteria->Set(min, max);
}
示例2: Execute
//----------------------------------------
int32_t CBratProcessExportAscii::Execute(string& msg)
{
int32_t result = BRATHL_SUCCESS;
CDate startExec;
startExec.SetDateNow();
if (m_product == NULL)
{
throw CException("PROGRAM ERROR: product is NULL (CBratProcessExportAscii::Execute) - Perhaps, initialization has not been called",
BRATHL_LOGIC_ERROR);
}
m_product->SetExpandArray(m_expandArray);
// Always 'expand array' for Netcdf Product (To show data in column and data value by line)
m_product->SetForceReadDataOneByOne(true);
m_writeHeader = true;
uint32_t nbFiles = m_inputFiles.size();
uint32_t cptFile = 0;
CStringArray::iterator itFile;
//for each file, read and write data
for (itFile = m_inputFiles.begin() ; itFile != m_inputFiles.end() ; itFile++)
{
cptFile++;
CTrace::Tracer(1,"File %d/%d - Reading record data from %s ... and registering data ...",
cptFile, nbFiles, (*itFile).c_str());
// open file an set record name and list of field to read
m_product->SetFieldSpecificUnits(m_fieldSpecificUnit);
m_product->Open(*itFile, m_recordName);
m_product->SetListFieldToRead(m_listFieldsToRead, false);
// Get the number of record for the default record name (set in Open method of CProduct above)
int32_t nRecords = m_product->GetNumberOfRecords();
for (int32_t iRecord = 0 ; iRecord < nRecords ; iRecord++)
{
//Read fields for the record name (listof field and record name are set in Open method of CProduct above)
m_product->ReadBratRecord(iRecord);
WriteData();
//m_writeHeader = false;
}
m_product->Close();
}
if (m_product->GetSkippedRecordCount() > 0)
{
string msg = CTools::Format("WARNING - %d input data records have been skipped due to inconsistency between two measures",
m_product->GetSkippedRecordCount());
CTrace::Tracer(1, msg);
}
CTrace::Tracer(1,"End processing - OK");
CDate endExec;
endExec.SetDateNow();
CTrace::Tracer(1, CTools::Format("Processing time: %.3f seconds (%.2f minutes)\n",
(endExec - startExec),
(endExec - startExec) / 60.0));
return result;
}