本文整理汇总了C++中TTimeIntervalMicroSeconds类的典型用法代码示例。如果您正苦于以下问题:C++ TTimeIntervalMicroSeconds类的具体用法?C++ TTimeIntervalMicroSeconds怎么用?C++ TTimeIntervalMicroSeconds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTimeIntervalMicroSeconds类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPlayPos
virtual dword GetPlayPos() const{
if(!inited)
return 0;
if(finished)
return GetPlayTime();
dword ret;
#ifdef USE_OPTIONAL_POSITIONING
const_cast<C_simple_sound_player_imp*>(this)->InitLib();
if(mca_GetPosition){
TTimeIntervalMicroSeconds p;
#ifdef _DEBUG
(plr->*mca_GetPosition)(p);
#else
mca_GetPosition(plr, p);
#endif
ret = (p.Int64()/TInt64(1000)).Low();
}else
ret = 0;
#else
TTimeIntervalMicroSeconds p;
plr->GetPosition(p);
ret = dword(p.Int64()/TInt64(1000));
#endif
return Min(ret, GetPlayTime());
}
示例2: TestBootupPerformanceL
void CTzBootPerformanceTest::TestBootupPerformanceL()
{
TTime startTime;
TTime endTime;
startTime.UniversalTime();
RTz tz;
User::LeaveIfError(tz.Connect());
endTime.UniversalTime();
tz.Close();
TTimeIntervalMicroSeconds micros = endTime.MicroSecondsFrom(startTime);
_LIT(KBootTime, "Time to connect time zone server = %d (ms) \n");
test.Printf(KBootTime,micros);
#ifndef __WINS__
#ifdef GetPerformanceBaseline
bootTimeBaseLine = micros.Int64();
_LIT(KBootTimeBaseLine, "The baseline of boot-up time = %d (ms) \n");
test.Printf(KBootTimeBaseLine,bootTimeBaseLine);
#else
test((micros.Int64()-bootTimeBaseLine)/bootTimeBaseLine<0.1);
#endif
#endif
}
示例3: timejan
void CCopyContactsAO::UpdateTimeStamp()
{
RFs fs;
fs.Connect();
TBuf<256> cdbFileName; // Contact db file name
if (iDatabase->FindContactFile(cdbFileName)) {
TTime cdbTime;
fs.Modified(cdbFileName, cdbTime);
TDateTime janNineteenSeventy
(1970,EJanuary,0,00,00,00,000000);
TTime timejan(janNineteenSeventy);
TTimeIntervalMicroSeconds interval =
cdbTime.MicroSecondsFrom(timejan);
TInt64 cdbVal;
cdbVal = interval.Int64()/1000;
TBuf<256> timestamp;
timestamp.Num(cdbVal);
iAppUi.AddTimeStampToFileL(×tamp);
}
fs.Close();
}
示例4: OstTraceExt3
// ---------------------------------------------------------------------------
// Configures the flex window sizes for both the initial delay and the
// consequent intervals after that. 64-bit version.
// ---------------------------------------------------------------------------
//
EXPORT_C TInt CFlexPeriodic::Configure(
TTimeIntervalMicroSeconds aDelayWindow,
TTimeIntervalMicroSeconds aIntervalWindow )
{
OstTraceExt3( TRACE_NORMAL, DUP1_CFLEXPERIODIC_CONFIGURE,
"CFlexPeriodic::Configure64;this=%x;"
"aDelayWindow=%lld;aIntervalWindow=%lld", ( TUint )this,
aDelayWindow.Int64(), aIntervalWindow.Int64() );
TTimeIntervalMicroSeconds zero( 0 );
__ASSERT_ALWAYS(aDelayWindow >= zero,
User::Panic(KCFlexPeriodicPanicCat,
EFlexPeriodicDelayWindowLessThanZero));
__ASSERT_ALWAYS(aIntervalWindow >= zero,
User::Panic(KCFlexPeriodicPanicCat,
EFlexPeriodicIntervalWindowLessThanZero));
// interval window is saved for later use. Delay window is sent
// immediately to server.
TInt ret = CFlexTimer::Configure( aDelayWindow );
if ( ret == KErrNone )
{
// Interval window is changed only, if configuration is successful.
iIntervalWindow = aIntervalWindow;
// This is set to true only, if the server is able to receive the
// delay window configuration.
iSendConfigure = ETrue;
}
return ret;
}
示例5: OstTraceExt4
// ---------------------------------------------------------------------------
// Starts the periodic timer. 64-bit delay and interval parameters.
// ---------------------------------------------------------------------------
//
EXPORT_C void CFlexPeriodic::Start( TTimeIntervalMicroSeconds aDelay,
TTimeIntervalMicroSeconds anInterval,
TCallBack aCallBack,
TCallBack aCallBackError )
{
OstTraceExt4( TRACE_NORMAL, CFLEXPERIODIC_START64,
"CFlexPeriodic::Start64;this=%x;aDelay=%lld;"
"anInterval=%lld;aCallBack=%x", ( TUint )this,
aDelay.Int64(), anInterval.Int64(), ( TUint )&( aCallBack ) );
TTimeIntervalMicroSeconds zero( 0 );
__ASSERT_ALWAYS(aDelay >= zero,
User::Panic(KCFlexPeriodicPanicCat,
EFlexPeriodicDelayLessThanZero));
__ASSERT_ALWAYS(anInterval > zero,
User::Panic(KCFlexPeriodicPanicCat,
EFlexPeriodicIntervalTooSmall));
__ASSERT_ALWAYS( aCallBack.iFunction != NULL,
User::Panic(KCFlexPeriodicPanicCat,
EFlexPeriodicCallbackFunctionIsNull));
// aCallBackError is left unasserted on purpose.
// if error occurs and callback is null client is paniced.
// Interval value is saved for later use, delay is sent immediately
// to the server.
iInterval = anInterval.Int64();
iCallBack = aCallBack;
iCallBackError = aCallBackError;
CFlexTimer::After( aDelay );
}
示例6: IsPlaying
EXPORT_C TBool TWsGraphicMsgAnimation::IsPlaying(const TTime& aNow,const TTimeIntervalMicroSeconds& aAnimationLength) const
{
// an animation to time?
if(aAnimationLength <= 0LL)
{
return EFalse;
}
switch(iFlags & EStateMask)
{
case EPaused:
return EFalse;
case EStopping:
{
const TInt64 elapsed = (aNow.Int64() - iPlay.Int64());
if(elapsed <= aAnimationLength.Int64())
{
return ETrue;
}
return EFalse;
}
case EStopped:
return EFalse;
case EPlaying:
{
const TInt64 elapsed = (aNow.Int64() - iPlay.Int64());
if((iFlags & ELoop) || (elapsed <= aAnimationLength.Int64()))
{
return ETrue;
}
return EFalse;
}
default:
return EFalse;
}
}
示例7: mediaIdAudio
void UT_CG711PayloadFormatWrite::UT_CG711PayloadFormatWrite_FrameTimeIntervalL( )
{
//iWrite->iFrameTimeInterval = 20000 * 2; // 20k * Channels
TTimeIntervalMicroSeconds catchAfish;
TMediaId mediaIdAudio( KUidMediaTypeAudio, 1 );
TMediaId mediaIdVideo( KUidMediaTypeVideo, 1 );
if ( !iAlloc )
{
catchAfish = iWrite->FrameTimeInterval ( mediaIdAudio );
EUNIT_ASSERT_EQUALS( catchAfish.Int64(), 0 );
catchAfish = iWrite->FrameTimeInterval ( mediaIdVideo );
EUNIT_ASSERT_EQUALS( catchAfish.Int64(), 0 );
}
else
{
EUNIT_ASSERT_NO_LEAVE( iWrite->FrameTimeInterval ( mediaIdAudio ) );
EUNIT_ASSERT_NO_LEAVE( iWrite->FrameTimeInterval ( mediaIdVideo ) );
}
}
示例8: gf_sys_get_rti
/*CPU and Memory Usage*/
GF_EXPORT
Bool gf_sys_get_rti(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags)
{
TInt ram, ram_free;
u32 now, time;
#ifdef __SERIES60_3X__
TModuleMemoryInfo mi;
#endif
TTimeIntervalMicroSeconds tims;
RProcess cur_process;
RThread cur_th;
now = gf_sys_clock();
if (!rti->sampling_instant) {
rti->sampling_instant = now;
if (cur_th.GetCpuTime(tims) != KErrNone) {
return 0;
}
#ifdef __SERIES60_3X__
rti->process_cpu_time = (u32) (tims.Int64() / 1000);
#else
rti->process_cpu_time = (u32) ( TInt64(tims.Int64() / 1000).GetTInt() );
#endif
return 0;
}
if (rti->sampling_instant + refresh_time_ms > now) return 0;
rti->sampling_period_duration = now - rti->sampling_instant;
rti->sampling_instant = now;
if (cur_th.Process(cur_process) != KErrNone) {
return 0;
}
#ifdef __SERIES60_3X__
if (cur_process.GetMemoryInfo(mi) != KErrNone) {
return 0;
}
rti->process_memory = mi.iCodeSize + mi.iConstDataSize + mi.iInitialisedDataSize + mi.iUninitialisedDataSize;
#endif
if (cur_th.GetCpuTime(tims) != KErrNone) {
return 0;
}
#ifdef __SERIES60_3X__
time = (u32) (tims.Int64() / 1000);
#else
time = (u32) ( TInt64(tims.Int64() / 1000).GetTInt() );
#endif
rti->process_cpu_time_diff = time - rti->process_cpu_time;
rti->process_cpu_time = time;
rti->process_cpu_usage = 100*rti->process_cpu_time_diff / rti->sampling_period_duration;
if (rti->process_cpu_usage > 100) rti->process_cpu_usage = 100;
HAL::Get(HALData::EMemoryRAM, ram);
HAL::Get(HALData::EMemoryRAMFree, ram_free);
rti->physical_memory = ram;
rti->physical_memory_avail = ram_free;
#ifdef GPAC_MEMORY_TRACKING
rti->gpac_memory = gpac_allocated_memory;
#endif
return 1;
}
示例9: LBSLOG
/** Adjusts system time if required. The decision whether the adjustment is needed or not
is based on the following criterias:
- satellite time must be present in the location update
- time threshold must be exceeded
- time from a last adjustment is greater than a defined interval.
@param aStatus An error code.
@param TPositionSatelliteInfo Position and time information.
If clock adjustment takes place the TPosition::iTime is
re-set to the satellite time.
@see CLbsAdmin
@see TPositionSatelliteInfo
*/
void CAutoClockAdjust::LocationUpdate(TInt aStatus, TPositionSatelliteInfo& aPosInfo)
{
LBSLOG(ELogP1, "CAutoClockAdjust::LocationUpdate()\n");
TTimeIntervalMicroSeconds timeCorr;
TTime sysTime;
TInt err;
// If adjustment on, no error, and satellite information present
if ((iClockAdjustSetting == CLbsAdmin::EClockAdjustOn) && (aStatus == KErrNone) &&
((aPosInfo.PositionClassType() & EPositionSatelliteInfoClass) == EPositionSatelliteInfoClass))
{
// Is is time do do another time adjustment?
sysTime.UniversalTime();
if (Abs(sysTime.MicroSecondsFrom(iLastAdjustment).Int64()) > (1000*iAdjustInterval))
{
const TPositionSatelliteInfo& satInfo = static_cast<const TPositionSatelliteInfo&>(aPosInfo);
err = CalculateTimeCorrection(satInfo, timeCorr);
if (err == KErrNone)
{
// Is threshold exceeded?
if (Abs(timeCorr.Int64()) > (1000*iAdjustThreshold))
{
sysTime.UniversalTime();
sysTime += timeCorr;
LBSLOG(ELogP9, "->S CGpsSetClockBase::SetUTCTime() ClockModule\n");
LBSLOG5(ELogP9, " > TTime sysTime = %02d:%02d:%02d.%06d\n", sysTime.DateTime().Hour(),
sysTime.DateTime().Minute(),
sysTime.DateTime().Second(),
sysTime.DateTime().MicroSecond());
err = iSetClockImpl->SetUTCTime(sysTime);
LBSLOG2(ELogP9, " Return = %d\n", err);
if (err == KErrNone)
{
// Sync the position time with the satellite time
// to avoid re-adjusting the system time by the manual clock adjustment component.
TPosition pos;
aPosInfo.GetPosition(pos);
pos.SetTime(aPosInfo.SatelliteTime());
aPosInfo.SetPosition(pos);
LBSLOG2(ELogP2, "ACTION: Clock Adjusted by %ld\n", timeCorr.Int64());
}
}
if (err == KErrNone)
{
// Remember the current time even if threshold not exceeded
iLastAdjustment = sysTime;
}
else
{
LBSLOG_WARN2(ELogP3, "Clock Adjustment failed. Error: %d\n", err);
}
}
}
}
}
示例10: StopTimer
TInt StopTimer(TTime aStartTimer)
{
TTime endTime;
endTime.HomeTime();
TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(aStartTimer);
TInt actualDuration = I64INT(duration.Int64())/1000; // in millisecond
return actualDuration;
}
示例11: NineteenSeventy
jlong Os::java_time_millis()
{
TTime NineteenSeventy(_L("19700000:000000.000000"));
TTime now;
now.UniversalTime();
TTimeIntervalMicroSeconds interval = now.MicroSecondsFrom(NineteenSeventy);
TInt64 time = interval.Int64() / 1000;
return ((jlong)I64HIGH(time) << 32) | (jlong)I64LOW(time);
}
示例12:
// ---------------------------------------------------------
// ---------------------------------------------------------
//
void CPosTp143::CheckCountersL()
{
iLog->Log(_L("CheckCountersL"));
TTime start, end;
CPosLandmarkDatabaseExtended* dbExt = CPosLandmarkDatabaseExtended::OpenL();
CleanupStack::PushL(dbExt);
iLog->Log(_L("checking LandmarksCount"));
start.UniversalTime();
TInt lmCount = dbExt->LandmarksCount();
end.UniversalTime();
TTimeIntervalMicroSeconds interval = end.MicroSecondsFrom( start );
iLog->Log(_L("LandmarksCount done in %ld us"), interval.Int64());
if ( lmCount != iLandmarks.Count() )
{
iLog->Log( _L("LandmarksCount wrong result, expected %d, actual %d"),
iLandmarks.Count(), lmCount );
User::Leave( KErrGeneral );
}
CPosLmItemIterator* iter = iDatabase->LandmarkIteratorL();
CleanupStack::PushL(iter);
if ( lmCount != iter->NumOfItemsL() )
{
iLog->Log( _L("CategoriesCount wrong result, expected %d, actual %d"),
iter->NumOfItemsL(), lmCount );
User::Leave( KErrGeneral );
}
CleanupStack::PopAndDestroy( iter );
iLog->Log(_L("checking CategoriesCount"));
start.UniversalTime();
TInt catCount = dbExt->CategoriesCount();
end.UniversalTime();
interval = end.MicroSecondsFrom( start );
iLog->Log(_L("CategoriesCount done in %ld us"), interval.Int64());
CPosLmCategoryManager& catman = dbExt->CategoryManager();
CPosLmItemIterator* catIter = catman.CategoryIteratorL();
CleanupStack::PushL(catIter);
if ( catCount != catIter->NumOfItemsL() )
{
iLog->Log( _L("CategoriesCount wrong result, expected %d, actual %d"),
catIter->NumOfItemsL(), catCount );
User::Leave( KErrGeneral );
}
CleanupStack::PopAndDestroy( catIter );
CleanupStack::PopAndDestroy( dbExt );
}
示例13: ASSERT
TTimeIntervalMicroSeconds CWsSpriteManager::CalculateTimeToNextFlash(TTimeIntervalMicroSeconds aTime) const
{
TInt64 nextStateChange;
if(aTime<KFlashHalfSecond)
nextStateChange=KFlashHalfSecond-aTime.Int64();
else
nextStateChange=KFlashHalfSecond - (aTime.Int64() - KFlashHalfSecond);
ASSERT(nextStateChange > 0);
return TTimeIntervalMicroSeconds(nextStateChange);
}
示例14: while
// -----------------------------------------------------------------------------
// CGameController::StartGameL
// Intializes the Game and Starts the game loop.
// -----------------------------------------------------------------------------
//
void CGameController::StartGameL( CGame& aGame )
{
iGame = &aGame;
// Allow the game to initialize itself.
// The opengl es state intialization is done here.
aGame.Initialize( iWindow->Size().iWidth, iWindow->Size().iHeight );
TTime currentTime;
TTime lastTimeVisited;
lastTimeVisited.HomeTime();
while( 1 ) // Loop until the Game wants to exit.
{
// Process any pending tasks.
// This runs any Active objects that are waiting for
// some processing.
// The CWsEventReceiver Active Object gets a chance to
// run here (on a key event for example).
ProcessBackgroundTasks( EFalse );
// If the application is not in focus or is not visible.
// Block until it regains focus.
while( EFalse == iIsAppInFocus || EFalse == iIsVisible )
ProcessBackgroundTasks( ETrue );
// Get the current time.
currentTime.HomeTime();
TTimeIntervalMicroSeconds dur
= currentTime.MicroSecondsFrom( lastTimeVisited );
// The game renders itself using opengl es apis.
// A return value of EFalse signifies an exit from the game.
// Pass in the time (in micro secs) elapsed since last call.
if( EFalse == aGame.RenderFrame( dur.Int64() ) )
{
break;
}
// Call eglSwapBuffers, which blits the graphics to the window.
eglSwapBuffers( iEglDisplay, iEglSurface );
// To keep the background light on.
if( !( ( iGame->GetCurrentFrame() )%100 ) )
{
User::ResetInactivityTime();
}
// Store the last time the Game was rendered.
lastTimeVisited = currentTime;
}
// Cleanup.
aGame.Cleanup();
}
示例15: status
TInt CStreamControl::GetDuration(TInt64& aDuration)
{
TInt status(KErrUnknown);
TTimeIntervalMicroSeconds duration;
status = iController.GetDuration(duration);
if (status == KErrNone)
{
aDuration = duration.Int64();
}
return status;
}