Exemple #1
0
void	SetFST( void )
{
	if( s_bFrameSkip == FALSE )		return;
	UpdateTime();
	while (m_lTime < (1000 / FRAME_PER_SEC))
		UpdateTime();

	m_lTime -= (1000 / FRAME_PER_SEC);
}
Exemple #2
0
void Custom1System::DispatchEvent()
{
	U8 u8State=0;
	
	time_t timep;
	struct tm *p;
	time(&timep);
	p=localtime(&timep);
	GetValue(cmndr.u32deviceid, cmndr.name, cmndr.pu8ParaBuf,&u8State);
	if(baseYear!=p->tm_year || baseMonth!=p->tm_mon || baseDay!=p->tm_mday)
	{
		UpdateTime();
		memcpy(&baseValue, cmndr.pu8ParaBuf, sizeof(float));
		
		float *pw=(float*)cmndw.pu8ParaBuf;
		float *pi=(float*)cmndd.pu8ParaBuf;
		*pw=0;
		*pi=4;
		UpdateTime();
		
	}
	else
	{	
		float *pw=(float*)cmndw.pu8ParaBuf;
		float *pr=(float*)cmndr.pu8ParaBuf;
		float *pi=(float*)cmndd.pu8ParaBuf;
		int i2f;
		float f=(*pr)-baseValue;
		i2f=(int)f;
		if(i2f>=1000)
		{	
			(*pw)=(float)(i2f%10000);
			*pi=4;
		}
		else if(i2f>=100)
		{	
			(*pw)=(float)(f*10);
			*pi=3;
		}
		else if(i2f>=10)
		{	
			(*pw)=(float)(f*100);
			*pi=2;
		}
		else
		{	
			(*pw)=(float)(f*1000);
			*pi=1;
		}
	}
	SetValue(cmndw.u32deviceid, cmndw.name, cmndw.pu8ParaBuf);
	SetValue(cmndd.u32deviceid, cmndd.name, cmndd.pu8ParaBuf);
}
void CNowPlayingCtrl::UpdateInfo( const MusikSongId &songid )
{
    std::auto_ptr<CMusikSong> pSong = songid.Song();
	//--- first things first, verify data in song ---//
	wxString sArtist = SanitizedString( ConvFromUTF8( pSong->MetaData.Artist ));
	wxString sTitle = SanitizedString( ConvFromUTF8( pSong->MetaData.Title ));
	wxString sAlbum = SanitizedString( ConvFromUTF8( pSong->MetaData.Album ));
	if ( sArtist.IsEmpty())
		sArtist = _( "Unknown Artist" );
	if ( sTitle.IsEmpty() )
		sTitle = _( "Unknown Song" );

	if (!(m_CurrSong.MetaData.Filename == pSong->MetaData.Filename 
        && m_CurrSong.MetaData.Artist == pSong->MetaData.Artist
        && m_CurrSong.MetaData.Album == pSong->MetaData.Album
        && m_CurrSong.MetaData.Title == pSong->MetaData.Title))
    {
        // song info has changed
        m_CurrSong = *pSong;
        m_pTunage->Started( *pSong );

        //--- title / artist / time -//
        sTitle.Replace	( wxT( "&" ), wxT( "&&" ), TRUE );
        sArtist.Replace	( wxT( "&" ), wxT( "&&" ), TRUE );

        if ( sTitle != stSong->GetLabel() )
            stSong->SetLabel( sTitle );
        if ( sArtist != stArtist->GetLabel() )
            stArtist->SetLabel( sArtist );
    }
	UpdateTime();
}
Exemple #4
0
void InputFile::Update () {
    time_t newTime = UpdateTime(GetName());
    if (newTime > updateTime) {
        Reread();
        updateTime = newTime;
    }
}
Exemple #5
0
/** Process an event. */
void ProcessEvent(XEvent *event)
{
   switch(event->type) {
   case ButtonPress:
   case ButtonRelease:
      HandleButtonEvent(&event->xbutton);
      break;
   case KeyPress:
      HandleKeyPress(&event->xkey);
      break;
   case KeyRelease:
      HandleKeyRelease(&event->xkey);
      break;
   case EnterNotify:
      HandleEnterNotify(&event->xcrossing);
      break;
   case MotionNotify:
      while(JXCheckTypedEvent(display, MotionNotify, event));
      UpdateTime(event);
      HandleMotionNotify(&event->xmotion);
      break;
   case LeaveNotify:
   case DestroyNotify:
   case Expose:
   case ConfigureNotify:
      break;
   default:
      Debug("Unknown event type: %d", event->type);
      break;
   }
}
Exemple #6
0
// disconnect from external sources -----------------------------------------
void __fastcall TPlot::Disconnect(void)
{
    AnsiString s;
    char *cmd;
    int i;
    
    trace(3,"Disconnect\n");
    
    if (!ConnectState) return;
    
    ConnectState=0;
    
    for (i=0;i<2;i++) {
        if (StrCmdEna[i][1]) {
            cmd=StrCmds[i][1].c_str();
            strwrite(Stream+i,(unsigned char *)cmd,strlen(cmd));
        }
        strclose(Stream+i);
    }
    if (strstr(Caption.c_str(),"CONNECT")) {
        Caption=s.sprintf("DISCONNECT%s",Caption.c_str()+7);
    }
    UpdateTime();
    UpdatePlot();
}
Exemple #7
0
void CMainWnd::OnPlayStop()
{
	// レジューム用の情報を取得しておく
	if (m_pOptions->m_fResume && MAP_GetStatus(m_hMap) != MAP_STATUS_STOP) {
		m_pOptions->m_nResumeTime = MAP_GetCurrent(m_hMap);
	}

	if (MAP_GetStatus(m_hMap) == MAP_STATUS_STOP)
		MAP_AudioDeviceClose(m_hMap);

	// 停止処理
	Stop();

	// シャッフルフラグをリセット
	if (m_pOptions->m_fShuffle) {
		ResetShuffle();
		FILEINFO* p = (FILEINFO*)m_pListFile->GetAt(m_nCurrent);
		if (p) p->fShuffle = TRUE;
	}

	// レジュームの場合時刻をセット
	if (m_pOptions->m_fResume) {
		MAP_Seek(m_hMap, m_pOptions->m_nResumeTime);
		m_pOptions->m_nResumeTime = 0;
	}

	UpdateTime();
	UpdateStatus();
	UpdateStreamTitle();
}
Exemple #8
0
/** Discard key events for the specified window. */
void DiscardKeyEvents(XEvent *event, Window w)
{
   JXSync(display, False);
   while(JXCheckTypedWindowEvent(display, w, KeyPress, event)) {
      UpdateTime(event);
   }
}
Exemple #9
0
BOOL CPpcMainWnd::DeleteFile(int nIndex)
{
	if (!m_pListFile->RemoveAt(nIndex))
		return FALSE;

	ListView_DeleteItem(m_hwndLV, nIndex);
	
	if (!m_pListFile->GetCount()) {
		Close();
		m_nCurrent = OPEN_NONE;
		InvalidateRect(m_hWnd, NULL, TRUE);
		UpdateWindow(m_hWnd);
	}
	else if (m_nCurrent == nIndex) {
		Stop();
		
		UpdateTime();
		UpdateStatus();
		m_nCurrent = OPEN_NONE;

		Open(m_pListFile->GetCount() - 1 < nIndex ? 0 : nIndex);
	}
	else if (m_nCurrent > nIndex) {
		m_nCurrent--;
		UpdateTrack();
	}
	return TRUE;
}
void CNowPlayingCtrl::UpdateInfo( const CMusikSong &song )
{
	//--- first things first, verify data in song ---//
	wxString sArtist = SanitizedString( ConvFromUTF8( song.MetaData.Artist ));
	wxString sTitle = SanitizedString( ConvFromUTF8( song.MetaData.Title ));
	wxString sAlbum = SanitizedString( ConvFromUTF8( song.MetaData.Album ));
	if ( sArtist.IsEmpty())
		sArtist = _( "Unknown Artist" );
	if ( sTitle.IsEmpty() )
		sTitle = _( "Unknown Song" );

	// tell Tunage to do it's thing if file has changed
	if ( m_LastFile != song.MetaData.Filename )
		m_pTunage->Execute( song );

	m_LastFile = song.MetaData.Filename;

	//--- caption bar title ---//
	g_MusikFrame->SetTitle( sArtist + wxT( " - " ) +  sTitle + (!sAlbum.IsEmpty() ? wxString(wxT( " - " )) + sAlbum : wxString()) );
	g_MusikFrame->SetSongInfoText( song );

	//--- title / artist / time -//
	sTitle.Replace	( wxT( "&" ), wxT( "&&" ), TRUE );
	sArtist.Replace	( wxT( "&" ), wxT( "&&" ), TRUE );

	if ( sTitle != stSong->GetLabel() )
		stSong->SetLabel( sTitle );
	if ( sArtist != stArtist->GetLabel() )
		stArtist->SetLabel( sArtist );
	UpdateTime();

	Layout();
}
Exemple #11
0
    ServerObject::ServerObject(Services::SharedPtr services, boost::asio::io_service& io, bool debug)
      : Server(services)
      , Io(io)
      , Debug(debug)
      , Instance(std::move(CreateServerObject(services)))
      , ServerTime(Instance.GetVariable(GetCurrentTimeRelativepath()))
      , Timer(io)
    {
      Timer.Start(boost::posix_time::seconds(1), [this](){
        UpdateTime();
      });
      //Set many values in address space which are expected by clients
      std::vector<std::string> uris; 
      uris.push_back("http://opcfoundation.org/UA/");
      uris.push_back("http://freeopcua.github.io");
      Node node = Node(Server, ObjectId::Server_NamespaceArray);
      node.SetValue(uris);
      node = Node(Server, ObjectId::Server_ServerStatus_BuildInfo_ManufacturerName);
      node.SetValue(std::string("FreeOpcUa"));
      node = Node(Server, ObjectId::Server_ServerCapabilities_LocaleIdArray);
      node.SetValue(std::vector<std::string>({ "en" }));
      node = Node(Server, ObjectId::Server_ServerStatus_BuildInfo_BuildNumber);
      node.SetValue(std::string("0.8"));
      node = Node(Server, ObjectId::Server_ServerStatus_BuildInfo_ProductName);
      node.SetValue(std::string("FreeOpcUa"));
      node = Node(Server, ObjectId::Server_ServerStatus_BuildInfo_ProductUri);
      node.SetValue(std::string("https://freeopcua.github.io"));
      node = Node(Server, ObjectId::Server_ServerStatus_State);
      node.SetValue((int32_t) 0);
      node = Node(Server, ObjectId::Server_ServerStatus_CurrentTime);
      node.SetValue(DateTime::Current());//Set time before the thread does it

    }
void RunPhysics()
{
	if (gSceneRunning)
		return;

	// Update the time step
	NxReal deltaTime = UpdateTime();

	deltaTime = 0.02f;	// todo: may go back to real time at some point

	// Run collision and dynamics for delta time since the last frame
#if 1
	NxSceneDesc desc;
	gScene->saveToDesc(desc);
	gScene->simulate(desc.maxTimestep);
#else
	gScene->simulate(deltaTime);
#endif

	gSceneRunning = true;
	WaitForPhysics();

	gSamples[gSampleIndex]->update();
	gFrameCounter++;

}
Exemple #13
0
PunchOut::PunchOut(QWidget *parent) :
    QFrame(parent),
    ui(new Ui::PunchOut)
{
    ui->setupUi(this);

    ui->label_warring->hide();
    ui->dateTimeEdit->setDateTime(QDateTime::currentDateTime());

    QTimer *timer=new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(UpdateTime()));
    //开启定时器
    timer->start(1000);

    // 显示是否已签退
    QSqlQuery query;
    query.prepare("select count(*) from punchreg where date = curdate() and persid = ? and outtime is not null");
    query.addBindValue(login_persid);
    query.exec();

    if(query.next()){
        if(query.value(0).toInt() != 0){
            ui->pushButton->hide();
            ui->label_warring->show();
        }
    }
}
LRESULT CALLBACK MyFunc(HWND this_hwnd,UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message) 
	{
	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	case WM_TIMER:
		UpdateTime(0.02f);
		InvalidateRect(hWnd, NULL, 0);
		break;

	case WM_PAINT:
		// перерисовываем только всё окно
		if(this_hwnd == hWnd)
		{
			PAINTSTRUCT ps;
			HDC ThisDC = BeginPaint(hWnd, &ps);
			PaintIt(ThisDC);
			EndPaint(hWnd, &ps);
		}

		break;
	}

	return DefWindowProc(this_hwnd, message, wParam, lParam);
}
Exemple #15
0
	void RouterProfile::TunnelBuildResponse (uint8_t ret)
	{
		if (ret > 0)
			m_NumTunnelsDeclined++;
		else
			m_NumTunnelsAgreed++;
		UpdateTime ();
	}	
Exemple #16
0
CBufLine::CBufLine(const CString& sFormat, const CString& sText, const timeval* ts) {
	m_sFormat = sFormat;
	m_sText = sText;
	if (ts == NULL)
		UpdateTime();
	else
		m_time = *ts;
}
Exemple #17
0
/*******************************************************************************
* Function checkRTC()
* ------------------------------------------------------------------------------
* Overview: Function checks if Time has changed (for polling purposes)
* Input: Nothing
* Output: Nothing
*******************************************************************************/
void checkRTC(){
  if (RTCC_Read(&MyTime)){
    if ((MyTime.minutes != OldMyTime.minutes) || (MyTime.hours != OldMyTime.hours) || (MyTime.ampm != OldMyTime.ampm)){
      UpdateTime(&MyTime);
      OldMyTime = MyTime;
    }
  }
}
Exemple #18
0
void LoginView::Layout()
{
	VLayoutNode* pcRoot = new VLayoutNode("root");
	
	pcUserIconView = new os::IconView(Rect(1,2,2000,82),"",CF_FOLLOW_ALL);
	pcUserIconView->SetSelChangeMsg(new Message(M_SEL_CHANGED));
	PopulateIcons();
	pcUserIconView->SetTabOrder( 1 );

	FrameView* pcFrameView = new FrameView(Rect(0,0,2000,84),"","");
	pcFrameView->AddChild(pcUserIconView);
	AddChild(pcFrameView);
	
	pcLayoutView = new LayoutView(Rect(0,89,GetBounds().Width(),GetBounds().Height()),"layout_view",NULL);
	
	HLayoutNode* pcPassNode = new HLayoutNode("pass_node");
	pcPassNode->AddChild(new HLayoutSpacer("",2,2));
	pcPassNode->AddChild(pcPassString = new StringView(Rect(),"pass_string","Password:"******"",2,2));
	pcPassNode->AddChild(pcPassText = new TextView(Rect(),"pass_text",""));
	pcPassText->SetPasswordMode(true);
	pcPassText->SetMaxPreferredSize(28,1);
	pcPassText->SetMinPreferredSize(28,1);
	pcPassText->SetTabOrder( 2 );
	pcPassNode->AddChild(new HLayoutSpacer("",5,5));
	pcPassNode->AddChild(pcLoginButton = new Button(Rect(),"login_but","_Login",new Message(M_LOGIN)));
	pcLoginButton->SetTabOrder( 3 );
	pcPassNode->AddChild(new HLayoutSpacer("",2,2));
	pcPassNode->SameHeight("login_but",NULL);
	pcPassNode->ExtendMaxSize(pcPassNode->GetPreferredSize(false));
	

	HLayoutNode* pcKeymapNode = new HLayoutNode("keymap_node");
	pcKeymapNode->AddChild(selector = new KeymapSelector(os::Messenger(pcParentWindow)));
	
	
	HLayoutNode* pcOtherNode = new HLayoutNode("other_node");
	pcOtherNode->SetHAlignment(ALIGN_RIGHT);	
	pcOtherNode->AddChild(pcShutdownButton = new Button(Rect(),"shut_but","_Shutdown",new Message(M_SHUTDOWN)));
	pcShutdownButton->SetTabOrder( 4 );
	pcOtherNode->AddChild(new HLayoutSpacer("",150,150));
	pcOtherNode->AddChild(pcDateString = new StringView(Rect(),"","9 Aug 05, 10:00am"));
	UpdateTime();
	
	pcRoot->AddChild(pcPassNode);
	pcRoot->AddChild(new os::VLayoutSpacer("",10,10));
	pcRoot->AddChild(pcKeymapNode);
	pcRoot->AddChild(new os::VLayoutSpacer("",10,10));
	pcRoot->AddChild(pcOtherNode);
	
	pcRoot->SameHeight("shut_but","login_but",NULL);
	pcRoot->SameWidth("shut_but","login_but",NULL);
	
	pcLayoutView->SetRoot(pcRoot);
	AddChild(pcLayoutView);
	
	ResizeTo(os::Point(pcLayoutView->GetPreferredSize(false).x,GetBounds().Height()));
}
Exemple #19
0
void CNTPDaemon::Run (void)
{
	while (1)
	{
		unsigned nSecondsToNextAttempt = UpdateTime ();
		
		CScheduler::Get ()->Sleep (nSecondsToNextAttempt);
	}
}
Exemple #20
0
/** Discard button events for the specified windows. */
void DiscardButtonEvents()
{
   XEvent event;
   JXSync(display, False);
   while(JXCheckMaskEvent(display, ButtonPressMask | ButtonReleaseMask,
			  &event)) {
      UpdateTime(&event);
   }
}
Exemple #21
0
void StartPhysics()
{
	// Update the time step
	NxReal deltaTime = UpdateTime();

	// Start collision and dynamics for delta time since the last frame
    gScene->simulate(deltaTime);
	gScene->flushStream();
}
// connect to external sources ----------------------------------------------
void __fastcall TPlot::Connect(void)
{
    AnsiString s;
    char *cmd,*path,buff[MAXSTRPATH],*name[2]={"",""},*p;
    int i,mode=STR_MODE_R;
    
    trace(3,"Connect\n");
    
    if (ConnectState) return;
    
    for (i=0;i<2;i++) {
        if      (RtStream[i]==STR_NONE    ) continue;
        else if (RtStream[i]==STR_SERIAL  ) path=StrPaths[i][0].c_str();
        else if (RtStream[i]==STR_FILE    ) path=StrPaths[i][2].c_str();
        else if (RtStream[i]<=STR_NTRIPCLI) path=StrPaths[i][1].c_str();
        else continue;
        
        if (RtStream[i]==STR_FILE||!SolData[i].cyclic||SolData[i].nmax!=RtBuffSize+1) {
            Clear();
            initsolbuf(SolData+i,1,RtBuffSize+1);
        }
        if (RtStream[i]==STR_SERIAL) mode|=STR_MODE_W;
        
        strcpy(buff,path);
        if ((p=strstr(buff,"::"))) *p='\0';
        if ((p=strstr(buff,"/:"))) *p='\0';
        if ((p=strstr(buff,"@"))) name[i]=p+1; else name[i]=buff;
        
        if (!stropen(Stream+i,RtStream[i],mode,path)) {
            ShowMsg(s.sprintf("connect error: %s",name));
            ShowLegend(NULL);
            trace(1,"stream open error: ch=%d type=%d path=%s\n",i+1,RtStream[i],path);
            continue;
        }
        strsettimeout(Stream+i,RtTimeOutTime,RtReConnTime);
        
        if (StrCmdEna[i][0]) {
            cmd=StrCmds[i][0].c_str();
            strwrite(Stream+i,(unsigned char *)cmd,strlen(cmd));
        }
        ConnectState=1;
    }
    if (!ConnectState) return;
    
    if (Title!="") Caption=Title;
    else Caption=s.sprintf("CONNECT %s %s",name[0],name[1]);
    
    BtnConnect->Down=true;
    BtnSol1   ->Down=*name[0];
    BtnSol2   ->Down=*name[1];
    BtnSol12  ->Down=false;
    BtnShowTrack->Down=true;
    BtnFixHoriz->Down=true;
    UpdateEnable();
    UpdateTime();
    UpdatePlot();
}
void PhysRun ( void )
{
	// Update the time step
	NxReal deltaTime = UpdateTime();

	// Run collision and dynamics for delta time since the last frame
	gScene->simulate(deltaTime);	
	gScene->flushStream();
	gScene->fetchResults(NX_RIGID_BODY_FINISHED, true);
}
Exemple #24
0
/** Discard enter notify events. */
void DiscardEnterEvents()
{
   XEvent event;
   JXSync(display, False);
   while(JXCheckMaskEvent(display, EnterWindowMask, &event)) {
      UpdateTime(&event);
      SetMousePosition(event.xmotion.x_root, event.xmotion.y_root,
                       event.xmotion.window);
   }
}
void
wxGamePanel::ResetShotClock(bool update)
{
    m_attackTime.Start();
    m_attackTime.Pause();
    m_playing = false;

    if (update)
        UpdateTime();
}
Exemple #26
0
void LogInternal(LogLevel level, const char *fmt, ...) {
  va_list  args;
  if (level > log_level) return;
  UpdateTime();
  if (log_file) fprintf(log_file, "%s [%s] ", now_str, LevelName[level]);
  va_start(args, fmt);
  if (log_file) vfprintf(log_file, fmt, args);
  va_end(args);
  fflush(log_file);
}
Exemple #27
0
bool RuntimeScene::RenderAndStep()
{
    requestedChange.change = SceneChange::CONTINUE;
    ManageRenderTargetEvents();
    UpdateTime();
    ManageObjectsBeforeEvents();
    SoundManager::Get()->ManageGarbage();

    #if defined(GD_IDE_ONLY)
    if( GetProfiler() )
    {
        if ( firstLoop ) GetProfiler()->Reset();
        GetProfiler()->eventsClock.reset();
    }
    #endif

    if (GetCodeExecutionEngine()->Ready())
    {
        #if !defined(RELEASE)
        BT_PROFILE("Events");
        #endif
        GetCodeExecutionEngine()->Execute();
    }

    #if defined(GD_IDE_ONLY)
    if( GetProfiler() && GetProfiler()->profilingActivated )
    {
        GetProfiler()->lastEventsTime = GetProfiler()->eventsClock.getTimeMicroseconds();
        GetProfiler()->renderingClock.reset();
    }
    #endif

    ManageObjectsAfterEvents();

    #if defined(GD_IDE_ONLY)
    if( debugger ) debugger->Update();
    #endif

    //Rendering
    Render();
    legacyTexts.clear();

    #if defined(GD_IDE_ONLY)
    if( GetProfiler() && GetProfiler()->profilingActivated )
    {
        GetProfiler()->lastRenderingTime = GetProfiler()->renderingClock.getTimeMicroseconds();
        GetProfiler()->totalSceneTime += GetProfiler()->lastRenderingTime + GetProfiler()->lastEventsTime;
        GetProfiler()->totalEventsTime += GetProfiler()->lastEventsTime;
        GetProfiler()->Update();
    }
    #endif

    firstLoop = false; //The first frame was rendered
    return requestedChange.change != SceneChange::CONTINUE;
}
void CBufferOutputVideoEngine::AddPacket(Packet* pData,UInt32 iSequence)
{
		//BufferTrace("CBufferOutputVideoEngine::AddPacket() begin %d\n",GetTickCount());
		// 	static UInt32 s_iCount = 0;
		// 	if (++s_iCount%80 == 0){//模拟丢包
		// 		pData->RemoveReference();
		// 		return;
		// 	}
		UInt32 iFrameSeq = 0;
		UInt32 iPieceCount = 0;
		if (!GetFrameSeq(pData,iFrameSeq,iPieceCount)){
			pData->RemoveReference();
			AssertVS(0,m_iFromUin,"CBufferOutputVideoEngine::AddPacket 视频数据包解析失败...");
			return;
		}

		MutexLocker m_locker(&m_mutex);//m_mapOutputVideoBuf buffer播放线程 m_mapFrameToSeq
		map<UInt32,StructVideoBufferPack>::iterator iter;
		if ((iter=m_mapOutputVideoBuf.find(iSequence))!=m_mapOutputVideoBuf.end() || 
			!IsNormalPacket(iFrameSeq,iSequence) || 
			m_mapOutputVideoBuf.size() > BUFFER_OUTPUT_VIDEO_PACKET_MAXLIMIT){
				LostTrace("CBufferOutputVideoEngine 收到无效数据包..............%s........数据包缓冲超限=%s,iSequence=%d,time=%d [minSequenceId:%d] [maxSequenceId:%d] [iMinFrameId:%d] [iMaxFrameId:%d]\n",
					m_mapOutputVideoBuf.find(iSequence)!=m_mapOutputVideoBuf.end()?"存在":"不存在",m_mapOutputVideoBuf.size()>BUFFER_OUTPUT_VIDEO_PACKET_MAXLIMIT?"TRUE":"FALSE",iSequence,GetTickCount(),m_iMinSequenceId,m_iMaxSequenceId,m_iMinFrameId,m_iMaxFrameId);
			pData->RemoveReference();
		}else{
			m_lastRecvTime = GetTickCount();

			StructVideoBufferPack svbp;
			svbp.m_iSequence = iSequence;
			svbp.m_pPack = pData;
			svbp.m_iPieceCount = iPieceCount;
			svbp.m_iFrameSeq = iFrameSeq;
			svbp.m_time = GetTickCount();
			m_mapOutputVideoBuf[iSequence] = svbp;

			AddFrameSeq(iFrameSeq);
			AddSequenceId(iSequence);
			UpdateTime(GetTickCount(),iFrameSeq);

			Assert(pData->GetReference()==1);

			map<UInt32,StructVideoFrameSeqToSeq>::iterator iter;
			if ((iter=m_mapFrameToSeq.find(iFrameSeq))!=m_mapFrameToSeq.end()){
				if (iSequence>iter->second.m_maxSequence){
					iter->second.m_maxSequence = iSequence;
				}
			}else{
				StructVideoFrameSeqToSeq struSeq;
				struSeq.m_minSequence = iSequence;
				struSeq.m_maxSequence = iSequence;
				m_mapFrameToSeq[iFrameSeq] = struSeq;
			}
		}
}
Exemple #29
0
void SBuildProgressWidget::SetBuildStatusText( const FText& StatusText )
{
	UpdateTime();
	
	// Only update the text if we haven't canceled the build.
	if( !bStoppingBuild )
	{
		BuildStatusText = StatusText;
		UpdateProgressText();
	}
}
Exemple #30
0
bool static MiningBlock(CBlock *pblock,CWallet *pwallet,CBlockIndex* pindexPrev,unsigned int nTransactionsUpdatedLast,CAccountViewCache &view, CTransactionDBCache &txCache, CScriptDBViewCache &scriptCache){

	int64_t nStart = GetTime();

	unsigned int lasttime = 0xFFFFFFFF;
	while (true) {

		// Check for stop or if block needs to be rebuilt
		boost::this_thread::interruption_point();
		if (vNodes.empty() && SysCfg().NetworkID() != CBaseParams::REGTEST)
			return false;


		if (pindexPrev != chainActive.Tip())
			return false;

		//获取时间 同时等待下次时间到
		auto GetNextTimeAndSleep = [&]() {
			while(max(pindexPrev->GetMedianTimePast() + 1, GetAdjustedTime()) == lasttime)
			{
				::MilliSleep(800);
			}
			return (lasttime = max(pindexPrev->GetMedianTimePast() + 1, GetAdjustedTime()));
		};

		GetNextTimeAndSleep();	// max(pindexPrev->GetMedianTimePast() + 1, GetAdjustedTime());
		UpdateTime(*pblock, pindexPrev);

		if (pindexPrev != chainActive.Tip())
			return false;


		set<CKeyID> setCreateKey;
		setCreateKey.clear();
		int64_t lasttime = GetTimeMillis();
		bool increatedfalg =CreatePosTx(pindexPrev, pblock, setCreateKey,view,txCache,scriptCache);
		LogPrint("MINER","CreatePosTx used time :%d ms\n",   GetTimeMillis() - lasttime);
		if (increatedfalg == true) {
			SetThreadPriority(THREAD_PRIORITY_NORMAL);
			{
			int64_t lasttime1 = GetTimeMillis();
			CheckWork(pblock, *pwallet);
		    LogPrint("MINER","CheckWork used time :%d ms\n",   GetTimeMillis() - lasttime1);
			}
			SetThreadPriority(THREAD_PRIORITY_LOWEST);

			return true;
		}

		if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast || GetTime() - nStart > 60)
				return false;
	}
	return false;
}