本文整理汇总了C++中COleDateTimeSpan类的典型用法代码示例。如果您正苦于以下问题:C++ COleDateTimeSpan类的具体用法?C++ COleDateTimeSpan怎么用?C++ COleDateTimeSpan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了COleDateTimeSpan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ttoi
//------------------------------------------------------------------------------------
bool CAutoRegisterConfig::SetTimeRange(
CDateTimeCtrl& start, CDateTimeCtrl& end,
CString& strStartMin, CString& strEndMin,
int nStartHour, int nEndHour )
{
SYSTEMTIME smStart, smEnd;
start.GetTime(&smStart);
end.GetTime(&smEnd);
m_startTime.SetDateTime(smStart.wYear, smStart.wMonth, smStart.wDay,nStartHour,
_ttoi(strStartMin), 0);
m_endTime.SetDateTime(smEnd.wYear, smEnd.wMonth, smEnd.wDay,nEndHour,
_ttoi(strEndMin), 0);
COleDateTimeSpan dtSpan = m_endTime - m_startTime;
if (dtSpan.GetTotalSeconds() <= 0)
{
AfxMessageBox(_T("结束时间不得小于起始时间"));
return false;
}
COleDateTime dtEnd, dtStart;
dtStart.SetDate(m_startTime.GetYear(), m_startTime.GetMonth(), m_startTime.GetDay());
dtEnd.SetDate(m_endTime.GetYear(), m_endTime.GetMonth(), m_endTime.GetDay());
COleDateTimeSpan dtSpan2;
if(dtSpan2.GetTotalDays() > m_array24Amount.size())
{
AfxMessageBox(_T("开始时间和结束时间之间的天数不能大于每天开户金额的天数"));
return false;
}
return true;
}
示例2: CheckTakeUp
BOOL CNDCheckInDlg::CheckTakeUp(CString strTermId)
{
//查询该终端是否被占用
BOOL bTakeUp = FALSE;
CLastUserInfo LastUserInfo;
if (CIBADAL::GetInstance()->GetLastUserInfo(LastUserInfo, 0, strTermId))
{
if (LastUserInfo.GetSuspend())//挂机
{
bTakeUp = TRUE;
}
else//非挂机
{
COleDateTime updateTime;
updateTime.ParseDateTime(LastUserInfo.GetUpdateTime());
COleDateTimeSpan interval = COleDateTime::GetCurrentTime() - updateTime;
if (interval.GetTotalMinutes() < 10)//被占用,并且用户还有效
{
bTakeUp = TRUE;
}
}
}
return bTakeUp;
}
示例3: GetUseTimeAsString
CString CActiveMember::GetUseTimeAsString()
{
CString strTmp;
if ( GetIsOnLine() )
{
COleDateTime dtNow = COleDateTime::GetCurrentTime();
COleDateTimeSpan dts = dtNow - CheckInTime;
//系统时间跟中心事件有差错时,可能存在为负的情况
if (dts < COleDateTimeSpan(0, 0, 0, 0))//时间为负
{
strTmp.Format(_T("%.2d:%.2d"), 0, 0);
}
else//正常
{
//{ 2011/04/22-gxx: 修改原来支持最大时长24小时为总时长, GetHours()-->GetTotalHours()
int nHours = (int)dts.GetTotalHours();
strTmp.Format(_T("%.2d:%.2d"), nHours, dts.GetMinutes());
//}
}
}
return strTmp;
}
示例4: ABBAdapter
// Start the server. This blocks until the server stops.
void AgentConfigurationEx::start ( )
{
GLogger.Fatal("AgentConfigurationEx::start\n");
for ( int i = 0; i < _devices.size( ); i++ )
{
ABBAdapter *_cmdHandler = new ABBAdapter(this, config, _devices[i]);
_cncHandlers.push_back(_cmdHandler);
_group.create_thread(boost::bind(&ABBAdapter::Cycle, _cncHandlers[i]) );
}
if ( Globals.ResetAtMidnight )
{
COleDateTime now = COleDateTime::GetCurrentTime( );
COleDateTimeSpan tilnextreset = COleDateTimeSpan(0, 1, 0, 0);
GLogger.Fatal(StdStringFormat("Agent will Reset from now %8.4f\n", ( tilnextreset.GetTotalSeconds( ) / 3600.00 ) ) );
_resetthread.Initialize( );
_resetthread.AddTimer(
(long) tilnextreset.GetTotalSeconds( ) * 1000,
&_ResetThread,
( DWORD_PTR ) this,
&_ResetThread._hTimer // stored newly created timer handle
);
}
AgentConfigurationT::start( ); // does not return
}
示例5: COleDateTime
// NOTE: Windows SCM more tolerant of slow starting processes than terminating processes.
void MtcOpcAdapter::start()
{
static char name[] = "MtcOpcAdapter::start";
_bRunning=true;
if(_bResetAtMidnight)
{
COleDateTime now = COleDateTime::GetCurrentTime();
COleDateTime date2 = COleDateTime(now.GetYear(), now.GetMonth(), now.GetDay(), 0, 0, 0) + COleDateTimeSpan(1, 0, 0, 1);
//COleDateTime date2 = now + COleDateTimeSpan(0, 0, 2, 0); // testing reset time - 2 minutes
COleDateTimeSpan tilmidnight = date2-now;
_resetthread.Initialize();
_resetthread.AddTimer(
(long) tilmidnight.GetTotalSeconds() * 1000,
&_ResetThread,
(DWORD_PTR) this,
&_ResetThread._hTimer // stored newly created timer handle
) ;
GLogger << INFO << "Adapter will Reset At Midnight " << date2.Format() << std::endl;
}
if(_bOPCEnabled)
{
_workerthread.Initialize();
::SetEvent (_StartThread._hEvent); // start OPC thread
_workerthread.AddHandle(_StartThread._hEvent, &_StartThread,(DWORD_PTR) this);
}
// This goes last... never returns
startServer();
}
示例6: ActivityCallback
static void __stdcall ActivityCallback(ConversionActivity* activity, void* userData)
{
COleDateTimeSpan ts;
ts.SetDateTimeSpan(0, 0, 0, activity->ElapsedTimeSpanInSeconds);
char spinner[] = {'-', '\\', '|', '/'};
if (_spinnerIndex++ >= 3) _spinnerIndex = 0;
TCHAR output1[128];
TCHAR output2[128];
TCHAR output3[128];
_stprintf_s(output1, _T(" %c %s converted: %sK d/l'ed:"),
spinner[_spinnerIndex],
ts.Format(_T("%H:%M:%S")),
CommaSeparate((ULONGLONG)activity->CurrentFileSize / 1024));
_stprintf_s(output2, _T("%sK"),
CommaSeparate((ULONGLONG)activity->DownloadCurrent / 1024));
_stprintf_s(output3, _T("/ %sK"),
CommaSeparate((ULONGLONG)activity->DownloadTotal / 1024));
_tprintf_s(_T("%s %s %s\r"), output1, output2, output3);
}
示例7: OnEndTimeChanged
void CDefineBundleTimeDlg::OnEndTimeChanged()
{
COleDateTime startTime;
startTime.ParseDateTime(m_btnStartTime.ToString());
COleDateTime endTime;
endTime.ParseDateTime(m_btnEndTime.ToString());
if (endTime <= startTime)
{
m_btnEndTime.SetDate(startTime);
endTime.ParseDateTime(m_btnEndTime.ToString());
}
COleDateTimeSpan sp = endTime - startTime;
INT nHours = (long)sp.GetTotalHours();
INT nMinutes = sp.GetMinutes();
CString strTmp;
strTmp.Format(_T("%d"), nHours);
m_edtHours.SetWindowText(strTmp);
strTmp.Format(_T("%d"), nMinutes);
m_edtMinutes.SetWindowText(strTmp);
TRACE("OnEndTimeChanged\n");
}
示例8: getAgent
// Start the server. This blocks until the server stops.
void AgentConfigurationEx::start()
{
GLogger.LogMessage(StdStringFormat("AgentConfigurationEx::start()\n"));
getAgent()->set_listening_port(Globals.HttpPort);
MTConnectService::setName(Globals.ServerName);
for(int i=0; i< _ipaddrs.size(); i++)
{
COpcAdapter * _cmdHandler = new COpcAdapter(this, config, _ipaddrs[i], _devices[i], _tags[i]);
_cncHandlers.push_back(_cmdHandler);
GLogger.LogMessage(StdStringFormat("AgentConfigurationEx::start COpcAdapter::Cycle() %x\n",_ipaddrs[i]), DBUG);
_group.create_thread(boost::bind(&COpcAdapter::Cycle, _cncHandlers[i]));
}
GLogger.LogMessage(StdStringFormat("Call AgentConfiguration::start() ed \n"));
if(Globals.ResetAtMidnight)
{
COleDateTime now = COleDateTime::GetCurrentTime();
COleDateTime date2 = COleDateTime(now.GetYear(), now.GetMonth(), now.GetDay(), 0, 0, 0) + COleDateTimeSpan(1, 0, 0, 1);
//COleDateTime date2 = now + COleDateTimeSpan(0, 0, 2, 0); // testing reset time - 2 minutes
COleDateTimeSpan tilmidnight = date2-now;
_resetthread.Initialize();
_resetthread.AddTimer(
(long) tilmidnight.GetTotalSeconds() * 1000,
&_ResetThread,
(DWORD_PTR) this,
&_ResetThread._hTimer // stored newly created timer handle
) ;
GLogger.LogMessage(StdStringFormat("Agent will Reset At Midnight %s \n", (LPCSTR) date2.Format()), DBUG);
}
AgentConfiguration::start(); // does not return
}
示例9: IsOffLinePossibility
BOOL CActiveMember::IsOffLinePossibility()
{
if ( GetIsOnLine() )
{
COleDateTimeSpan dtSpan = COleDateTime::GetCurrentTime() - UpdateDataTime;
// 2014-1-10-qsc 把6m30s改成2m30s
return dtSpan.GetTotalSeconds() > (2 * 60 + 30); //上一次的更新时间和当前时间的间隔>2m30s
// 可以认为可能离线了。
}
return FALSE;
}
示例10: switch
double CChartAxis::GetNextTickValue(double Previous)
{
double NewTick = 0;
switch (m_AxisType)
{
case atStandard:
NewTick = Previous + m_TickIncrement;
break;
case atLogarithmic:
NewTick = Previous * m_TickIncrement;
break;
case atDateTime:
{
COleDateTime dtTick((DATE)Previous);
COleDateTimeSpan dtSpan;
switch (m_BaseInterval)
{
case tiSecond:
dtSpan.SetDateTimeSpan(0,0,0,m_iDTTickIntervalMult);
dtTick += dtSpan;
break;
case tiMinute:
dtSpan.SetDateTimeSpan(0,0,m_iDTTickIntervalMult,0);
dtTick += dtSpan;
break;
case tiHour:
dtSpan.SetDateTimeSpan(0,m_iDTTickIntervalMult,0,0);
dtTick += dtSpan;
break;
case tiDay:
dtSpan.SetDateTimeSpan(m_iDTTickIntervalMult,0,0,0);
dtTick += dtSpan;
break;
case tiMonth:
{
dtTick = AddMonthToDate(dtTick,m_iDTTickIntervalMult);
}
break;
case tiYear:
break;
}
NewTick = (DATE)dtTick;
}
break;
}
return NewTick;
}
示例11: FiletimeAsTimeSpan
CString FiletimeAsTimeSpan(const PROPVARIANT& propVar)
{
FILETIME ftNull;
ftNull.dwLowDateTime = 0;
ftNull.dwHighDateTime = 0;
COleDateTime coledtNull(ftNull);
COleDateTime coledtEditTime(propVar.filetime);
COleDateTimeSpan coledtsTotalEditTime = coledtEditTime - coledtNull;
CString sPropValue;
sPropValue.Format(_T("%.0f"), coledtsTotalEditTime.GetTotalMinutes());
return sPropValue;
}
示例12: ASSERT
void CSystemTray::OnTimer(UINT nIDEvent)
{
ASSERT(nIDEvent == m_nIDEvent);
COleDateTime CurrentTime = COleDateTime::GetCurrentTime();
COleDateTimeSpan period = CurrentTime - m_StartTime;
if (m_nAnimationPeriod > 0 && m_nAnimationPeriod < period.GetTotalSeconds())
{
StopAnimation();
return;
}
StepAnimation();
}
示例13: OnBnClickedOk
void CDefineBundleTimeDlg::OnBnClickedOk()
{
CString strRet;
COleDateTime startTime;
startTime.ParseDateTime(m_btnStartTime.ToString());
COleDateTime endTime;
endTime.ParseDateTime(m_btnEndTime.ToString());
COleDateTimeSpan sp = endTime - startTime;
UINT nAllMinites = (LONG)sp.GetTotalMinutes();
if (nAllMinites <= 0)
{
strRet = _T("包时时间有误,请重新选择!");
SetToolTipPos(IDOK);
ShowToolTip(strRet);
return;
}
CString strMoney;
m_edtBundTimeMoney.GetWindowText(strMoney);
if (strMoney.IsEmpty())
{
GetDlgItem(IDC_EDIT_BUNDTIMEMONEY)->SetFocus();
return;
}
CWaitCursor Wait;
double dBundTimeMoney = _tstof(strMoney);
UINT nBundTimeMoney = (dBundTimeMoney + 0.005) * 100; //作舍入转换
INT nIdx = m_cboArea.GetCurSel();
//2011-4-18-gxx: 保存开户时自定义包时的参数设置
m_BundleTimeInfo.TimeId = 9999;
m_BundleTimeInfo.BeginTime = startTime.Format(_T("%Y%m%d%H%M%S"));
m_BundleTimeInfo.TimePass = nAllMinites;
m_BundleTimeInfo.Amount = nBundTimeMoney;
m_BundleTimeInfo.PcClass = m_cboArea.GetItemData(nIdx);
m_BundleTimeInfo.AccountType = m_cboAccountType.GetCurSel();
m_BundleTimeInfo.bIsSelected = TRUE;
OnOK();
}
示例14: domDocHelper
void TestDominoDocArtifact::TestModifiedTime()
{
COleDateTime currentTime = COleDateTime::GetCurrentTime();
DomDocHelper domDocHelper(TEST_ARTIFACT_FILE);
DominoDocArtifact validArtifact(m_spLibrary, domDocHelper.DocumentId, domDocHelper.GetVersionLabel());
COleDateTime dominoDocmodifiedTime = validArtifact.ModifiedTime;
assertTest(COleDateTime::invalid != dominoDocmodifiedTime.GetStatus());
assertTest(COleDateTime::null != dominoDocmodifiedTime.GetStatus());
COleDateTimeSpan OleDateTimeSpan = dominoDocmodifiedTime - currentTime;
assertTest(0 == OleDateTimeSpan.GetHours());
assertTest(2 >= OleDateTimeSpan.GetMinutes());
}
示例15: time
BOOL COptionsStats::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CTime time(CGetSetOptions::GetTotalDate());
m_eAllDate = time.Format("%m/%d/%Y %I:%M %p");
m_eAllCopies.Format(_T("%d"), CGetSetOptions::GetTotalCopyCount());
m_eAllPastes.Format(_T("%d"), CGetSetOptions::GetTotalPasteCount());
CTime time2(CGetSetOptions::GetTripDate());
m_eTripDate = time2.Format("%m/%d/%Y %I:%M %p");
m_eTripCopies.Format(_T("%d"), CGetSetOptions::GetTripCopyCount());
m_eTripPastes.Format(_T("%d"), CGetSetOptions::GetTripPasteCount());
m_eClipsSent.Format(_T("%d"), theApp.m_lClipsSent);
m_eClipsRecieved.Format(_T("%d"), theApp.m_lClipsRecieved);
m_eLastStarted = theApp.m_oldtStartUp.Format(_T("%m/%d/%y %I:%M:%S"));
if(theApp.m_oldtStartUp.GetHour() > 12)
m_eLastStarted += " PM";
else
m_eLastStarted += " AM";
COleDateTimeSpan span = COleDateTime::GetCurrentTime() - theApp.m_oldtStartUp;
CString csSpan;
csSpan.Format(_T(" - %d.%d.%d (D.H.M)"), (long)span.GetTotalDays(), span.GetHours(), span.GetMinutes());
m_eLastStarted += csSpan;
try
{
m_eSavedCopies.Format(_T("%d"), theApp.m_db.execScalar(_T("SELECT COUNT(lID) FROM Main")));
m_eSavedCopyData.Format(_T("%d"), theApp.m_db.execScalar(_T("SELECT COUNT(lID) FROM Data")));
}
CATCH_SQLITE_EXCEPTION
__int64 size = FileSize(GetDBName());
const int MAX_FILE_SIZE_BUFFER = 255;
TCHAR szFileSize[MAX_FILE_SIZE_BUFFER];
StrFormatByteSize(size, szFileSize, MAX_FILE_SIZE_BUFFER);
m_eDatabaseSize = szFileSize;
UpdateData(FALSE);
theApp.m_Language.UpdateOptionStats(this);
return TRUE;
}