void Servo_Service(void) { unsigned int val; if(Elapsed(servoSOF)>Micros(18000UL)) { Servo_Rewind(); servoSOF=GetTime(); } if(Count>7) return; if(TIMER_ON) return; if(Val[Count]==0) { Count++; return; } NextPort=Port[Count]; NextMask=Mask[Count]; val=~Val[Count]; TIMER_H=val>>8; TIMER_L=val&255; TIMER_IF=0; __critical { //*NextPort=(*NextPort)|NextMask; FSR0L=(unsigned char)NextPort; FSR0H=(unsigned int)NextPort>>8; INDF0|=NextMask; TIMER_ON=1; } Count++; }
float Timer::ElapsedMillis() { #ifdef AURORA_TARGET_PLATFORM_WINDOWS return Elapsed() * 1000.0f; #elif defined(AURORA_TARGET_ENVIRONMENT_POSIX) return std::chrono::duration_cast<milliseconds_type>(HighResolutionClock::now() - start).count(); #endif }
void cUIControlAnim::Update() { cUIDragable::Update(); if ( NULL != mMoveAnim && mMoveAnim->Enabled() ) { mMoveAnim->Update( Elapsed() ); Pos( (eeInt)mMoveAnim->GetPos().x, (eeInt)mMoveAnim->GetPos().y ); if ( mMoveAnim->Ended() ) eeSAFE_DELETE( mMoveAnim ); } if ( NULL != mAlphaAnim && mAlphaAnim->Enabled() ) { mAlphaAnim->Update( Elapsed() ); Alpha( mAlphaAnim->GetRealPos() ); if ( mAlphaAnim->Ended() ) { if ( ( mControlFlags & UI_CTRL_FLAG_CLOSE_FO ) ) Close(); if ( ( mControlFlags & UI_CTRL_FLAG_DISABLE_FADE_OUT ) ) { mControlFlags &= ~UI_CTRL_FLAG_DISABLE_FADE_OUT; Visible( false ); } eeSAFE_DELETE( mAlphaAnim ); } } if ( NULL != mScaleAnim && mScaleAnim->Enabled() ) { mScaleAnim->Update( Elapsed() ); Scale( mScaleAnim->GetPos() ); if ( mScaleAnim->Ended() ) eeSAFE_DELETE( mScaleAnim ); } if ( NULL != mAngleAnim && mAngleAnim->Enabled() ) { mAngleAnim->Update( Elapsed() ); Angle( mAngleAnim->GetRealPos() ); if ( mAngleAnim->Ended() ) eeSAFE_DELETE( mAngleAnim ); } }
bool ColorTimeline::OnUpdate(float prevElapsed,float dt, float blend /*= 1.f*/) { ColorTimelineModel* model = (ColorTimelineModel*)mModel; Color4F color= model->GetColor(Elapsed())*blend; INode* node = (INode*)mTarget; node->SetColor(color); return true; }
bool TextureFileIdTimeline::OnUpdate(float prevElapsed,float dt, float blend /*= 1.f*/) { TextureFileIdTimelineModel* model = (TextureFileIdTimelineModel*)mModel; FileIdRef fileId = model->GetFileId(Elapsed()); auto renderingObject = RenderingObjectFactory::Instance().CreateFromTexture(fileId); INode* node = (INode*)mTarget; node->SetRenderingObject(renderingObject); return true; }
String TTimeLapse::AsStr(TDateTime dt) { if ((int)dt == 0) dt = Elapsed(); dt.DecodeTime(&FHour, &FMin, &FSec, &FMSec); String str; if (FHour != 0) str = dt.FormatString("h':'nn':'ss"); else str = dt.FormatString("n':'ss"); return str; }
BOOL MonotonicTime::Elapsed(UINT32 interval, BOOL update) { if ( Elapsed( interval ) ) { //#if defined(__WXGTK__) // interval = interval * CLOCKS_PER_SEC / 1000; //#endif if ( update ) SampleTime += interval; return TRUE; } return FALSE; }
void cxTimeLine::OnStep(cxFloat dt) { cxFloat elapsed = Elapsed(); for(cxInt i = idx;i<Length();i++){ if(elapsed < times.at(i)){ break; } if(prev == i){ continue; } idx = i; prev = i; OnTime(At(idx)); } cxAction::OnStep(dt); }
void Logger::WriteItem(const char* item) { #ifdef LOGTOSOCKET char buf[MAX_BUF]; snprintf(buf,sizeof(buf), "%f%s\n",Elapsed(),item); if(status == 0){ write(sockd, buf, strlen(buf)); } else { //printf(&buf[0)]); } #else /* Use current native logger port */ LOGITIMETOPIC(item); #endif }
String TTimeLapse::AsString(const bool ms, TDateTime dt) { if ((int)dt == 0) dt = Elapsed(); dt.DecodeTime(&FHour, &FMin, &FSec, &FMSec); String str; if (FHour != 0) str = IntToStr(FHour) + " Hours, "; str += dt.FormatString("n' Minutes, 's"); if (ms) str += dt.FormatString("'.'z"); str += " Seconds"; return str; }
std::string ProgressTimer::GetProgressMessage(double progress, bool bIncludeElapsed, bool bIncludeRemaining) const { const double miliSecs = Elapsed(); std::string result; if (bIncludeElapsed) { if (!result.empty()) result += " "; result += "Elapsed: " + TimeToString(miliSecs); } if (bIncludeRemaining && progress > 0.0) { if (!result.empty()) result += " "; result += "Remaining: " + TimeToString(miliSecs * (1.0-progress)/progress); } return result; }
double Timer::ElapsedSecond() const { return Elapsed() / (double) GetFrequency(); }
/** * Combines a call to Elapsed() and Update(). */ int ElapsedUpdate() { const auto now = GetNow(); int result = Elapsed(now); Update(now); return result; }
/** * Returns the number of milliseconds elapsed since the last * update(). Returns -1 if update() was never called. */ int Elapsed() const { return Elapsed(GetNow()); }
TimeStamp::TimeDiff TimeStamp::ElapsedMillisecond()const { return (Elapsed() / 1000); }
gcc_pure bool HasExpired() const { return Elapsed() > 0; }
float Timer::ElapsedMillis() { return Elapsed() * 1000.0f; }
/** difference. for elapsed from current usage */ Elapsed operator-(Elapsed const& start) const { return Elapsed(sec-start.sec, wallSec-start.wallSec, peakBytes, peakBytes-start.peakBytes); }
Elapsed now() const { return Elapsed(timer, kMeasureProcessMemory); }
/** * Returns the number of milliseconds remaining until the timeout * expires. The time has already expired if the return value is * negative. */ gcc_pure int GetRemainingSigned() const { return -Elapsed(); }
int StopWatch::ElapsedSeconds() const { return int(Elapsed()/Resolution()); }