当前位置: 首页>>代码示例>>C++>>正文


C++ COleDateTimeSpan::GetTotalSeconds方法代码示例

本文整理汇总了C++中COleDateTimeSpan::GetTotalSeconds方法的典型用法代码示例。如果您正苦于以下问题:C++ COleDateTimeSpan::GetTotalSeconds方法的具体用法?C++ COleDateTimeSpan::GetTotalSeconds怎么用?C++ COleDateTimeSpan::GetTotalSeconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COleDateTimeSpan的用法示例。


在下文中一共展示了COleDateTimeSpan::GetTotalSeconds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: start

// 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
}
开发者ID:johnmichaloski,项目名称:MTConnectToolbox,代码行数:30,代码来源:ABBftpAgent.cpp

示例2: start

// 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();
}
开发者ID:CubeSpawn-Research,项目名称:MTConnectToolbox,代码行数:33,代码来源:MtcOpcAdapter.cpp

示例3: start

// 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
}
开发者ID:CubeSpawn-Research,项目名称:MTConnectToolbox,代码行数:35,代码来源:MTCSiemensAgent.cpp

示例4: SetTimeRange

//------------------------------------------------------------------------------------
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;
}
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:35,代码来源:DlgAutoRegister.cpp

示例5: ToRelativeTimeString

/**
 *	Generates a display string showing the relative time between the two given times as COleDateTimes
 */
CString CLoglistUtils::ToRelativeTimeString(COleDateTime time,COleDateTime RelativeTo)
{
	COleDateTimeSpan ts = RelativeTo - time;

	//years
	if(fabs(ts.GetTotalDays()) >= 3 * 365)
		return ExpandRelativeTime((int)ts.GetTotalDays()/365, IDS_YEAR_AGO, IDS_YEARS_AGO);

	//Months
	if(fabs(ts.GetTotalDays()) >= 60)
		return ExpandRelativeTime((int)ts.GetTotalDays()/30, IDS_MONTH_AGO, IDS_MONTHS_AGO);

	//Weeks
	if(fabs(ts.GetTotalDays()) >= 14)
		return ExpandRelativeTime((int)ts.GetTotalDays()/7, IDS_WEEK_AGO, IDS_WEEKS_AGO);

	//Days
	if(fabs(ts.GetTotalDays()) >= 2)
		return ExpandRelativeTime((int)ts.GetTotalDays(), IDS_DAY_AGO, IDS_DAYS_AGO);

	//hours
	if(fabs(ts.GetTotalHours()) >= 2)
		return ExpandRelativeTime((int)ts.GetTotalHours(), IDS_HOUR_AGO, IDS_HOURS_AGO);

	//minutes
	if(fabs(ts.GetTotalMinutes()) >= 2)
		return ExpandRelativeTime((int)ts.GetTotalMinutes(), IDS_MINUTE_AGO, IDS_MINUTES_AGO);

	//seconds
	return ExpandRelativeTime((int)ts.GetTotalSeconds(), IDS_SECOND_AGO, IDS_SECONDS_AGO);
}
开发者ID:15375514460,项目名称:TortoiseGit,代码行数:34,代码来源:LoglistUtils.cpp

示例6: ResetAtMidnite

bool AgentConfigurationEx::ResetAtMidnite ( )
{
	COleDateTime now   = COleDateTime::GetCurrentTime( );
#ifndef RESETTEST
	COleDateTime date2 = COleDateTime(now.GetYear( ), now.GetMonth( ), now.GetDay( ), 0, 0, 0) + COleDateTimeSpan(1, 0, 0, 1);
#else
	COleDateTime date2 =  now +  COleDateTimeSpan(0, 0, 2, 0); // testing reset time - 2 minutes
#endif
	COleDateTimeSpan tilmidnight = date2 - now;
	GLogger.Fatal(StdStringFormat("Agent will Reset at  %s\n", date2.Format("%A, %B %d, %Y %H:%M:%S")  ) );
	GLogger.Fatal(StdStringFormat("Agent will Reset %8.4f hours::min from now\n", ( tilmidnight.GetTotalSeconds( ) / 3600.00 ) ) );

	_resetthread.Initialize( );
	_resetthread.AddTimer(
		(long) tilmidnight.GetTotalSeconds( ) * 1000,
		&_ResetThread,
		( DWORD_PTR ) this,
		&_ResetThread._hTimer      // stored newly created timer handle
		);
	return true;
}
开发者ID:johnmichaloski,项目名称:MTConnectToolbox,代码行数:21,代码来源:NikonAgent.cpp

示例7: 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;
}
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:13,代码来源:ActiveMember.cpp

示例8: OnTimer

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();
}
开发者ID:wernight,项目名称:clocks-sounds,代码行数:14,代码来源:SystemTray.cpp

示例9: ResetAtMidnite

bool AgentConfigurationEx::ResetAtMidnite ( )
{
  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
    );
  return true;
}
开发者ID:johnmichaloski,项目名称:MTConnectToolbox,代码行数:17,代码来源:ABBftpAgent.cpp

示例10: FinishMeasurement

void VirtualMeasurement::FinishMeasurement(COleDateTime odtMTime)
{

	_iMPMeasurementDateYear = odtMTime.GetYear();
	_iMPMeasurementDateMonth = odtMTime.GetMonth();
	_iMPMeasurementDateDay = odtMTime.GetDay();

	_fMPNChanA = (float)_dAve.val[NeutA];
	_fMPNChanB = (float)_dAve.val[NeutB];
	_fMPNChanC = (float)_dAve.val[NeutC];
	_fMPGDose1 = (float)_dAve.val[Gamma1];
	_fMPGDose2 = (float)_dAve.val[Gamma2];

	COleDateTimeSpan delta = odtMTime;
	delta -= delta.GetDays();

	_fMPNChanBThresh = (float)delta.GetTotalSeconds();

	CalcCoolingTime();
	ApplyAdjustments();
	//SetDetectorID();

	Certify();
}
开发者ID:hnordquist,项目名称:FDMS,代码行数:24,代码来源:VMeasurement.cpp

示例11: OnTimer

void CRecordingManagerWnd::OnTimer(UINT nIDEvent) 
{
	ASSERT(m_pRM != NULL);
	if (CRecordingManager::TIMER_ID_RECORDING_TIMEOUT == nIDEvent)
	{
		if (!m_pRM->m_bRecording)
		{
			DebugTell(_T("CRecordingManagerWnd[%d]::OnTimer: Fallible timer TIMER_ID_RECORDING_TIMEOUT ticking when there is no recording. Tossing tick."),
				m_pRM->m_pRoomObj->m_pRoom->ID);
			CWnd::OnTimer(nIDEvent);
			return;
		}
		COleDateTimeSpan odts = COleDateTime::GetCurrentTime() - m_pRM->m_odtLastRecordingTimeoutCheck;
		m_pRM->m_odtLastRecordingTimeoutCheck = COleDateTime::GetCurrentTime();
		if (odts.GetTotalSeconds() >= 60) /* this will put a message in the log every minute */
		{
			DebugTell(_T("CRecordingManagerWnd[%d]::OnTimer: Recording has %d seconds before timing out."),
				m_pRM->m_pRoomObj->m_pRoom->ID,m_pRM->m_uiRemainingTimerTicks);
		}
		if (--m_pRM->m_uiRemainingTimerTicks <= 0)
		{
			DebugTell(_T("CRecordingManagerWnd[%d]::OnTimer: Recording timeout for non-activity."),m_pRM->m_pRoomObj->m_pRoom->ID);
			KillTimer(nIDEvent);

			m_pRM->m_bBusy = true;
			m_pRM->m_dwBusySwipeCount = 0;
			m_pRM->m_odtLastBusySetTime = COleDateTime::GetCurrentTime();
			if (m_pRM->m_pStateCurrentRecording->m_sStateName != "CStateRecording")
			{	// uh oh... this is in an unrecognized state...
				DebugTell(_T("CRecordingManagerWnd[%d]::OnTimer: System is in the wrong state (%s) -- forcing recording reset."),m_pRM->m_pRoomObj->m_pRoom->ID,
					m_pRM->m_pStateCurrentRecording->m_sStateName);
				m_pRM->m_bRecording = true;
			}
			// set the system to busy so that card swipes will be ignored until
			// the stop recording command is complete.
			m_pRM->QueueCommand(CSSM_MESSAGE_STATECHANGE,CStateBaseRecording::eStateStopping);
		}
		else if (m_pRM->m_uiRemainingTimerTicks <= 15)
		{
			m_pRM->ReportElapsedTime(true);	// display remaining time
		}
	}

	if (CRecordingManager::TIMER_ID_RECORDING_COMPLETE_SCREEN_RESET == nIDEvent)
	{
		KillTimer(CRecordingManager::TIMER_ID_RECORDING_COMPLETE_SCREEN_RESET);
		m_pRM->RecordingCompleteScreenReset();
	}
	
	if (CRecordingManager::TIMER_ID_RECORDING_DISPLAY_TIME == nIDEvent)
	{
		if (!m_pRM->m_bRecording)
		{
			DebugTell(_T("CRecordingManagerWnd[%d]::OnTimer: Fallible timer TIMER_ID_RECORDING_DISPLAY_TIME ticking when there is no recording. Tossing tick."),
				m_pRM->m_pRoomObj->m_pRoom->ID);
			CWnd::OnTimer(nIDEvent);
			return;
		}
		m_pRM->ReportElapsedTime();
	}
	
	if (CRecordingManager::TIMER_ID_IDLE_DISPLAY_TIME == nIDEvent)
	{
		m_pRM->ReportTime();
	}

	if (CRecordingManager::TIMER_ID_RECORDING_STARTUP_TIMEOUT == nIDEvent)
	{
		m_pRM->KillTimerAndMessages(CRecordingManager::TIMER_ID_RECORDING_STARTUP_TIMEOUT);
		m_pRM->AbortRecording();
	}

	CWnd::OnTimer(nIDEvent);
}
开发者ID:CarverLab,项目名称:Oyster,代码行数:74,代码来源:RecordingManagerWnd.cpp

示例12: CalculateTickIncrement

void CChartAxis::CalculateTickIncrement()
{
	if (!m_bAutoTicks)
		return;

	if (m_MaxValue == m_MinValue)
	{
		m_iDTTickIntervalMult = 0;
		m_TickIncrement = 0;
		return;
	}

	int PixelSpace;
	if (m_bIsHorizontal)
	{
		if (m_AxisType == atDateTime)
			PixelSpace = 60;
		else
			PixelSpace = 30;
	}
	else
		PixelSpace = 20;

	int MaxTickNumber = (int)fabs((m_EndPos-m_StartPos)/PixelSpace * 1.0);

	//Calculate the appropriate TickSpace (1 tick every 30 pixel +/-)
	switch (m_AxisType)
	{
	case atLogarithmic:
	   m_TickIncrement = 10;
	   break;

	case atStandard:
		{
	   		//Temporary tick increment
    		double TickIncrement = (m_MaxValue-m_MinValue)/MaxTickNumber;
	    
    		// Calculate appropriate tickSpace (not rounded on 'strange values' but 
    		// on something like 1, 2 or 5*10^X  where X is optimalized for showing the most
    		// significant digits)
    		int Zeros = (int)floor(log10(TickIncrement));
    		double MinTickIncrement = pow(10.0,Zeros);
	    
    		int Digits = 0;
    		if (Zeros<0)		
    		{
				//We must set decimal places. In the other cases, Digits will be 0.
    			Digits = (int)fabs(Zeros*1.0);
    		}
	    
    		if (MinTickIncrement>=TickIncrement)
    		{
    			m_TickIncrement = MinTickIncrement;
    			SetDecimals(Digits);
    		}
    		else if (MinTickIncrement*2>=TickIncrement)
    		{
    			m_TickIncrement = MinTickIncrement*2;
    			SetDecimals(Digits);
    		}
    		else if (MinTickIncrement*5>=TickIncrement)
    		{
    			m_TickIncrement = MinTickIncrement*5;
    			SetDecimals(Digits);
    		}
    		else if (MinTickIncrement*10>=TickIncrement)
    		{
    			m_TickIncrement = MinTickIncrement*10;
    			if (Digits)
    				SetDecimals(Digits-1);
    			else
    				SetDecimals(Digits);
    		}
		}
		break;

	case atDateTime:
		{
			COleDateTime StartDate(m_MinValue);
			COleDateTime EndDate(m_MaxValue);

			COleDateTimeSpan minTickInterval = (EndDate - StartDate)/MaxTickNumber;
			double Seconds = minTickInterval.GetTotalSeconds();
			double Minutes = minTickInterval.GetTotalMinutes();
			double Hours = minTickInterval.GetTotalHours();
			double Days = minTickInterval.GetTotalDays();
			if (Seconds < 60)
			{
				m_BaseInterval = tiSecond;
				if (Seconds > 30)
				{
					m_BaseInterval = tiMinute;
					m_iDTTickIntervalMult = 1;
				}
				else if (Seconds > 10)
					m_iDTTickIntervalMult = 30;
				else if (Seconds > 5)
					m_iDTTickIntervalMult = 10;
				else if (Seconds > 2)
					m_iDTTickIntervalMult = 5;
//.........这里部分代码省略.........
开发者ID:fara-ramin,项目名称:firewall,代码行数:101,代码来源:ChartAxis.cpp

示例13: GetLocalExpense

UINT CActiveMember::GetLocalExpense(BOOL bFilter)
{
	if (PolicyInfo.IsEmpty())
	{
		return GetAmount();
	}
	if (PolicyInfo.GetLength() != 24*4)
	{
		IBA_ASSERT2(FALSE, "warning:扣率信息有误");
		CIBALog::GetInstance()->WriteFormat(_T("本地用户扣率信息有误,netId=%s, 扣率=%s"), NetId, PolicyInfo);
		return GetAmount();
	}
	if (CheckInTime.GetStatus() != COleDateTime::valid || CheckInTime == 0)
	{
		return GetAmount();
	}
	COleDateTime timeNow = COleDateTime::GetCurrentTime();
	COleDateTimeSpan timeSpan = timeNow - CheckInTime;

	UINT nPolicyHours[24] = {0};
	for (int i = 0; i < 96; i+=4)
	{
		nPolicyHours[i/4] = (UINT)_ttoi(PolicyInfo.Mid(i, 4));
	}

	double dExp = 0.0;
	int iStartHour = CheckInTime.GetHour();
	int iStartSecond = CheckInTime.GetSecond()+ CheckInTime.GetMinute()*60;
	int nTotalSecond = (int)timeSpan.GetTotalSeconds();
	for(int iSecond = nTotalSecond; iSecond > 0; )
	{
		if (nPolicyHours[iStartHour] == 0)
		{
			IBA_ASSERT2(FALSE,"warning:扣率信息有误,扣率为0");
			CIBALog::GetInstance()->WriteFormat(_T("本地用户扣率信息有误,netId=%s, 扣率=%s"), NetId, PolicyInfo);
			return GetAmount();
		}
		double dSecondPolicy = nPolicyHours[iStartHour%24] / 3600.0;

		int nSeconds = 3600 - iStartSecond;
		if (nSeconds >= iSecond)
		{
			nSeconds = iSecond;
		}
		
		dExp += dSecondPolicy * nSeconds;
		iSecond -= nSeconds;
		iStartHour ++;
		iStartSecond = 0; // 第一次循环以后,起始秒都为0
	}

	if (bFilter)
	{
		UINT nExp = UINT(dExp+49)/50*50;
		return nExp;
	}
	else
	{
		return UINT(dExp);
	}
	
}
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:62,代码来源:ActiveMember.cpp

示例14: LandSimulation

int LandSimulation(int landfg,char* strInputFilePath,CProgressWnd* pwndProgress)
{
	CString ReportFilePath(strInputFilePath);
	ReportFilePath.TrimRight("inp");
	CString OutputFilePath = ReportFilePath;
	ReportFilePath += "rpt";
	OutputFilePath += "out";
	char* strReportFilePath = ReportFilePath.GetBuffer(ReportFilePath.GetLength());
	char* strOutputFilePath = OutputFilePath.GetBuffer(OutputFilePath.GetLength());
	
	// initialize progress bar
	pwndProgress->SetRange(0, 100);			 
	pwndProgress->SetText("");
	CString strMsg, strForDdg, strE;

	COleDateTime time_i;		// time at the beginning of the simulation
	COleDateTime time_f;		// time at the end of the simulation
	COleDateTimeSpan time_dif;	// simulation run time
	SYSTEMTIME tm;				// system time
	GetLocalTime(&tm);
	time_i = COleDateTime(tm);

	long newHour, oldHour = 0;
	DateTime elapsedTime = 0.0;

	// --- open the files & read input data
	ErrorCode = 0;
	swmm_open(strInputFilePath,strReportFilePath,strOutputFilePath);

	// --- run the simulation if input data OK
	if ( !ErrorCode )
	{
		// --- initialize values
		swmm_start(TRUE);

		// --- execute each time step until elapsed time is re-set to 0
		if ( !ErrorCode )
		{
			int y, m, d;
			datetime_decodeDate(StartDateTime, &y, &m, &d);
			COleDateTime tStart(y,m,d,0,0,0);
			datetime_decodeDate(EndDateTime, &y, &m, &d);
			COleDateTime tEnd(y,m,d,0,0,0);
			COleDateTimeSpan span0 = tEnd - tStart;

			do
			{
				swmm_step(&elapsedTime);
				newHour = elapsedTime * 24.0;

				COleDateTimeSpan span = COleDateTimeSpan(0,newHour,0,0);
				COleDateTime tCurrent = tStart + span;

				int nSYear = tCurrent.GetYear();
				int nSMonth = tCurrent.GetMonth();
				int nSDay = tCurrent.GetDay();
				int nSHour = tCurrent.GetHour();

				GetLocalTime(&tm);
				time_f = COleDateTime(tm);
				time_dif = time_f - time_i;

				int dd_elap = int(time_dif.GetDays());
				int hh_elap = int(time_dif.GetHours());
				int mm_elap = int(time_dif.GetMinutes());
				int ss_elap = int(time_dif.GetSeconds());

				if ( newHour > oldHour )
				{
					oldHour = newHour;

					if (landfg == 0)
						strMsg.Format("Land Simulation:\t Pre-Development Scenario\n");
					else
						strMsg.Format("Land Simulation:\t Post-Development Scenario\n");
					strForDdg = strMsg;

					strMsg.Format("Calculating:\t %02d-%02d-%04d\n", nSMonth, nSDay, nSYear);
					strForDdg += strMsg;
					
					strE.Format("\nTime Elapsed:\t %02d:%02d:%02d:%02d\n", dd_elap, hh_elap, mm_elap, ss_elap);
					strForDdg += strE;

					double lfPart = span.GetTotalSeconds();
					double lfAll  = span0.GetTotalSeconds();
					double lfPerc = lfPart/lfAll;

					if(pwndProgress->GetSafeHwnd() != NULL && nSHour == 0)
					{
						pwndProgress->SetText(strForDdg);
						pwndProgress->SetPos((int)(lfPerc*100));
						pwndProgress->PeekAndPump();
					}

					if (pwndProgress->Cancelled())
					{
						pwndProgress->DestroyWindow();
						AfxMessageBox("BMP simulation is cancelled");
						break;
					}
//.........这里部分代码省略.........
开发者ID:Geosyntec,项目名称:SUSTAIN,代码行数:101,代码来源:Global.cpp

示例15: AddToListEnglish


//.........这里部分代码省略.........
			if(m_storeLog.store[i].rec_type & LOST_RECODE)
			{
				strType += _T(",LOST_RECODE");
			}
			if(m_storeLog.store[i].rec_type & HIDE_RECODE)
			{
				strType += _T(",HIDE_RECODE");
			}
			if(m_storeLog.store[i].rec_type & NET_FAULT_RECODE)
			{
				strType += _T(",NET_FAULT_RECODE");
			}
			if(m_storeLog.store[i].rec_type & PIR_RECODE)
			{
				strType += _T(",PIR_RECODE");
			}
			strType = strType.Right(strType.GetLength() - 1 );
		}
		else
		{
			if(m_storeLog.store[i].rec_type & TIMER_RECODE)
			{
				strType = _T("TIMER_RECODE");
			}
			if(m_storeLog.store[i].rec_type & ALARM_RECODE)
			{
				strType = _T("ALARM_RECODE");
			}
			if(m_storeLog.store[i].rec_type & MOVE_RECODE)
			{
				strType = _T("MOVE_RECODE");
			}
			if(m_storeLog.store[i].rec_type & MANUAL_RECODE)
			{
				strType = _T("MANUAL_RECODE");
			}
			if(m_storeLog.store[i].rec_type & LOST_RECODE)
			{
				strType = _T("LOST_RECODE");
			}
			if(m_storeLog.store[i].rec_type & HIDE_RECODE)
			{
				strType = _T("HIDE_RECODE");
			}
			if(m_storeLog.store[i].rec_type & NET_FAULT_RECODE)
			{
				strType = _T("NET_FAULT_RECODE");
			}
			if(m_storeLog.store[i].rec_type & PIR_RECODE)
			{
				strType += _T("PIR_RECODE");
			}
		}
	
	


		CString strStartTime = _T("");
		CString strEndTime =_T("");
		CString StartTime = _T("");
		CString EndTime = _T("");

		strStartTime.Format(_T("%d-%02d-%02d-%02d:%02d:%02d"),m_storeLog.store[i].beg_time.year+1900,m_storeLog.store[i].beg_time.month,
			m_storeLog.store[i].beg_time.date, m_storeLog.store[i].beg_time.hour ,
			m_storeLog.store[i].beg_time.minute, m_storeLog.store[i].beg_time.second);

		strEndTime.Format(_T("%d-%02d-%02d-%02d:%02d:%02d"),m_storeLog.store[i].end_time.year+1900,m_storeLog.store[i].end_time.month,
			m_storeLog.store[i].end_time.date, m_storeLog.store[i].end_time.hour ,
			m_storeLog.store[i].end_time.minute, m_storeLog.store[i].end_time.second);
		//计算时间段的差
		COleDateTime  tStartDateTime;
		COleDateTime  tEndDateTime;
		tStartDateTime.SetDateTime(m_storeLog.store[i].beg_time.year+1900,m_storeLog.store[i].beg_time.month,
			m_storeLog.store[i].beg_time.date, m_storeLog.store[i].beg_time.hour ,
			m_storeLog.store[i].beg_time.minute, m_storeLog.store[i].beg_time.second);
		tEndDateTime.SetDateTime(m_storeLog.store[i].end_time.year+1900,m_storeLog.store[i].end_time.month,
			m_storeLog.store[i].end_time.date, m_storeLog.store[i].end_time.hour ,
			m_storeLog.store[i].end_time.minute, m_storeLog.store[i].end_time.second);


		m_lRecFileSize[j] = m_storeLog.store[i].file_size;  //保存录像文件的大小  下载时计算进度


		COleDateTimeSpan tMinute = tEndDateTime - tStartDateTime;  // 计算两个日期时间的差值
		DOUBLE dMinute = tMinute.GetTotalSeconds();
		CString strFileTimes = _T("");
		strFileTimes.Format(_T("%ld"), (LONG)dMinute);

		CString strFileSize = _T("");//录像大小
		strFileSize.Format(_T("%d"), m_storeLog.store[i].file_size/(1024*1024));

		m_VideoPlayBack.InsertItem(j,strId );
		m_VideoPlayBack.SetItemText(j, 1, strType);
		m_VideoPlayBack.SetItemText(j, 2, strStartTime);
		m_VideoPlayBack.SetItemText(j, 3, strEndTime);
		m_VideoPlayBack.SetItemText(j, 4, strFileTimes);
		m_VideoPlayBack.SetItemText(j, 5, strFileSize);
		j++;
	}
	}
开发者ID:mk-z,项目名称:Scan,代码行数:101,代码来源:VideoPlayBack.cpp


注:本文中的COleDateTimeSpan::GetTotalSeconds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。