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 ) ); } }
// --------------------------------------------------------------------------- // 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; }
// --------------------------------------------------------------------------- // 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 ); }
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()); }
/*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; }
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; } }
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 }
/** 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); } } } } }
// --------------------------------------------------------- // --------------------------------------------------------- // 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 ); }
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); }
EXPORT_C TUint DataPosition(TTimeIntervalMicroSeconds aPosition, TTimeIntervalMicroSeconds aFrameTime, TUint aFrameLength) { TInt64 dataPosition64(0); if(aFrameTime.Int64() != 0) dataPosition64 = aPosition.Int64() * aFrameLength / aFrameTime.Int64() ; return I64INT(dataPosition64); }
void CMMFDataPath2::FillSourceBufferL() { __ASSERT_DEBUG((iState == EPlaying || iState == EConverting || iState == ERecording || (iState == EPrimed && iPauseCalled && iIsUsingResumeSupport) ), Panic(EMMFDataPathPanicBadState,__LINE__)); //if the silence timer is active then dont propagate the request if(iRepeatTrailingSilenceTimer->IsActive()) { return; } //play the silence period and dont propagate the request if(iTrailingSilenceLeftToPlay>0 || iVerifyPlayComplete) { if(iVerifyPlayComplete)//case when the trailing silence is zero { if (!*iDisableAutoIntent && iDrmSource) { CMMFFile* file = static_cast<CMMFFile*>(iDrmSource); TInt err = file->ExecuteIntent(ContentAccess::EPlay); if (err != KErrNone) { DoSendEventToClient(KMMFEventCategoryPlaybackComplete, err); return; } } //Retrieve the current play time and add "duration-currentplaytime" to the silence period //This is to ensure that silence timer is not started before the previous play is actually completed by the devsound TTimeIntervalMicroSeconds currentTime = CalculateAudioOutputPosition(); if(currentTime.Int64()>iPlayWindowStartPosition.Int64()) { iTimeLeftToPlayComplete = iPlayWindowEndPosition.Int64()-currentTime.Int64(); } else { iTimeLeftToPlayComplete = 0; } iVerifyPlayComplete = EFalse; } if(iTrailingSilenceLeftToPlay==0 && iTimeLeftToPlayComplete==0) { SetPositionL(iPlayWindowStartPosition); iTimeLeftToPlayComplete=-1; } else { PlaySilence(); return; } } DoFillSourceBufferL(); }
static void PerformanceTest2L() { test.Printf(_L("\nHuge Ini file(684Kb) performance test\n")); //This test will try finding values within different section in the ini file, beginning //middle and end of the file. //Light weight testing TTime startTime, stopTime; TPtrC16 value; startTime.UniversalTime(); for (TInt i=0;i<1;i++) { CIniFile16* ini=CIniFile16::NewL(TheRFs,_L("z:\\resource\\big16.ini")); test(ini->FindVar(_L("Secure_DB_Backup"),_L("source"),value)==KErrNone); test(value.Compare(_L("C:\\private\\100012a5\\DBS_100065FF_performance.cdb"))==0); test(ini->FindVar(_L("20701_AddEntries"),_L("firstname430"),value)==KErrNone); test(value.Compare(_L("Husham"))==0); test(ini->FindVar(_L("20701_AddEntries"),_L("homemobile514"),value)==KErrNone); test(value.Compare(_L("07763 222730"))==0); test(ini->FindVar(_L("20701_AddEntries"),_L("dummyI830"),value)==KErrNone); test(value.Compare(_L(""))==0); test(ini->FindVar(_L("20701_AddEntries"),_L("workemail1066"),value)==KErrNone); test(value.Compare(_L("*****@*****.**"))==0); delete ini; } stopTime.UniversalTime(); TTimeIntervalMicroSeconds timeTaken = stopTime.MicroSecondsFrom(startTime); test.Printf(_L("Time taken for Light= %d microseconds\n"), timeTaken.Int64() ); //heavy weight testing startTime.UniversalTime(); for (TInt j=0;j<1;j++) { CIniDocument16* dom=CIniDocument16::NewL(TheRFs,_L("z:\\resource\\big16.ini")); test(dom->GetKeyValue(_L("Secure_DB_Backup"),_L("source"),value)==KErrNone); test(value.Compare(_L("C:\\private\\100012a5\\DBS_100065FF_performance.cdb"))==0); test(dom->GetKeyValue(_L("20701_AddEntries"),_L("firstname430"),value)==KErrNone); test(value.Compare(_L("Husham"))==0); test(dom->GetKeyValue(_L("20701_AddEntries"),_L("homemobile514"),value)==KErrNone); test(value.Compare(_L("07763 222730"))==0); test(dom->GetKeyValue(_L("20701_AddEntries"),_L("dummyI830"),value)==KErrNone); test(value.Compare(_L(""))==0); test(dom->GetKeyValue(_L("20701_AddEntries"),_L("workemail1066"),value)==KErrNone); test(value.Compare(_L("*****@*****.**"))==0); delete dom; } stopTime.UniversalTime(); timeTaken = stopTime.MicroSecondsFrom(startTime); test.Printf(_L("Time taken for Heavy= %d microseconds\n"), timeTaken.Int64() ); }
void CProtocolExadump::DoPacket(const RMBufPacketBase &aPacket, const RMBufPktInfo &aInfo) /** * Dump the packet. * * This is called for both incoming and outgoing packets, from the * respective ApplyL methods. * * @param aPacket The packet data * @param aInfo The packet inforrmation */ { /** @code */ // Open the dump file, if not already opened (or attempted). if (iOpen == 0) DoOpen(1500); if (iOpen < 0) return; // cannot open output file. // // Build PCAP frame into iBuffer (pcap_pkthdr + snapped portion of the packet) // TPtr8 buf = iBuffer->Des(); struct pcap_pkthdr *const hdr = (struct pcap_pkthdr *)buf.Ptr(); TPtr8 ptr((TUint8 *)buf.Ptr() + sizeof(*hdr), buf.MaxLength() - sizeof(*hdr)); const TInt snap = aInfo.iLength > ptr.MaxLength() ? ptr.MaxLength() : aInfo.iLength; ptr.SetLength(snap); aPacket.CopyOut(ptr); hdr->caplen = snap; hdr->len = aInfo.iLength; TTime stamp; stamp.UniversalTime(); const TTimeIntervalMicroSeconds elapsed = stamp.MicroSecondsFrom(iBase); #ifdef I64INT hdr->ts.tv_usec = I64INT(elapsed.Int64() % 1000000); hdr->ts.tv_sec = I64INT(elapsed.Int64() / 1000000); #else hdr->ts.tv_usec = (elapsed.Int64() % 1000000).GetTInt(); hdr->ts.tv_sec = (elapsed.Int64() / 1000000).GetTInt(); #endif // // Write frame out. // iDumpFile.Write(buf, snap+sizeof(*hdr)); /** @endcode */ }
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(); }
TInt CRecordTimeAvailable::PostProcess(CStifSectionParser* /*aParser*/) { TTimeIntervalMicroSeconds newTimeAvailable = recorder->RecordTimeAvailable(); LogTime(_L("Clip duration:"),fileDuration); LogTime(_L("New record time available:"),newTimeAvailable); TInt64 val = newTimeAvailable.Int64(); if ((val = Abs(timeAvailable.Int64() - newTimeAvailable.Int64() - fileDuration.Int64())) > errorRange.Int64()) { LogTime(_L("Time available difference is out of specified range:"),val); return KErrOutOfRange; } return KErrNone; }
EXPORT_C TTimeIntervalMicroSeconds DurationCalculation( TUint aDataLength, TTimeIntervalMicroSeconds aFrameTime, TUint aFrameLength) { TTimeIntervalMicroSeconds duration(0); //default if ((aFrameTime.Int64() != 0) && aFrameLength) { const TInt64 frameTime = aFrameTime.Int64(); duration = TTimeIntervalMicroSeconds( TInt64(aDataLength) / (TInt64(aFrameLength) * frameTime)); } return duration; }
void CTestDevVideoPlayClock::MmcspuoTick(const TTimeIntervalMicroSeconds& aTime) { iPeriodicUtilityIteration++; TUint currentTime = I64LOW(aTime.Int64()); TUint predictedTime = iPeriodicUtilityIteration * KTestClock2Seconds; if (!TimeComparison(currentTime, predictedTime, KTestClockBigDeviationMS)) { ERR_PRINTF3(_L("Error - Periodic Utility time comparison failed: Got %u; Expected %u"), currentTime, predictedTime); iPeriodicUtilityTestVerdict = EFail; iPeriodicUtility->Stop(); CActiveScheduler::Stop(); } else { INFO_PRINTF3(_L("Periodic Utility time comparison passed: Got %u; Expected %u"), currentTime, predictedTime); } if (iPeriodicUtilityIteration >= 5) { iPeriodicUtility->Stop(); CActiveScheduler::Stop(); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CSymbianUnitTestResult::EndTestL() { TTime now; now.UniversalTime(); TTimeIntervalMicroSeconds microSeconds = now.MicroSecondsFrom(iTime); TReal64 ms= microSeconds.Int64(); //log the test time in milliseconds SUT_LOG_FORMAT2(_L("EndCase Result[%S] Time[%d]ms"), iCurrentResult?&KSymbianUnitTestPass:&KSymbianUnitTestFail, microSeconds.Int64()/1000); if (iCurrentResult) { //only add passed case to the testcasenames iTestCaseNames->AppendL(*iCurrentTestName); } }
EXPORT_C void COggVorbisFile::SetPositionL(TTimeIntervalMicroSeconds aPos) { // using tremor: so milliseconds not seconds TInt64 milliseconds = aPos.Int64()/TInt64(1000); //RDebug::Printf("SetPositionL: %f\n", milliseconds.GetTInt()); iBody->SetPositionL(milliseconds.GetTInt()); }
/* ------------------------------------------------------------------------------- Class: CSimpleTimeout Method: Start Description: voip audio service - Start timeout counting Parameters: None Return Values: None Errors/Exceptions: None Status: Approved ------------------------------------------------------------------------------- */ void CSimpleTimeout::Start(TTimeIntervalMicroSeconds aTimeout) { FTRACE(FPrint(_L("CSimpleTimeout::Start"))); if (IsActive()) { Cancel(); } // Request timer TTime endTime; endTime.HomeTime(); endTime = endTime + aTimeout; TInt64 miliseconds = aTimeout.Int64(); miliseconds /= 1000; TBuf<30> dateString; endTime.FormatL(dateString, KFormatTimeStamp); iLog->Log(_L("Timer=%LD ms, EndTime=%S"), miliseconds, &dateString); // Store absolute timeout iTestCaseTimeout = endTime; // Taken from STIF engine // Note: iTimer.After() method cannot use because there needed // TTimeIntervalMicroSeconds32 and it is 32 bit. So then cannot create // timeout time that is long enough. At() uses 64 bit value=>Long enough. iTimer.At(iStatus, endTime); SetActive(); }
/** Sets the data path position. @param aPosition The data path position. */ void CMMFDataPath2::SetPositionL(const TTimeIntervalMicroSeconds& aPosition) {//need to map to source position to frame position #ifdef _DP_DEBUG RDebug::Print(_L("DP::SetPositionL = %d ticks-%d (this 0x%x)\n"),I64INT(aPosition.Int64()), User::TickCount(),this); #endif if (iState == EStopped) { User::Leave(KErrNotReady); //can only set position if primed } if(iGetTimePlayedSupported) { TTimeIntervalMicroSeconds timePlayed(0); if(iState == EPlaying && iDataSink->DataSinkType() == KUidMmfAudioOutput) { CMMFAudioOutput* audioOutput = STATIC_CAST(CMMFAudioOutput*,iDataSink); CMMFDevSound& devSound = audioOutput->SoundDevice(); TInt err= devSound.GetTimePlayed(timePlayed); if(err == KErrNone) { iDevSoundRepositionTime = timePlayed.Int64(); } } else {
void CTrackingPsy::IssueRequest(TTimeIntervalMicroSeconds updateInterval) { qDebug() << "CTrackingPsy::IssueRequest - START updateInterval " << updateInterval.Int64() << "PSY= " << iPsyName ; iClientRequestActive = ETrue; TTimeIntervalMicroSeconds timeOut(30000000);//30 seconds CSelfManagingPsy::IssueRequest(updateInterval, timeOut); }
void EnsureSystemIdle() { const TInt KMaxWait = 60 * 1000000; const TInt KSampleTime = 1 * 1000000; const TInt KWaitTime = 5 * 1000000; test.Printf(_L("Waiting for system to become idle\n")); TInt totalTime = 0; TBool idle; do { RThread thread; test_KErrNone(thread.Create(_L("EnsureSystemIdleThread"), EnsureSystemIdleThread, 1024, NULL, NULL)); thread.SetPriority(EPriorityLess); TRequestStatus status; thread.Rendezvous(status); thread.Resume(); User::WaitForRequest(status); test_KErrNone(status.Int()); User::After(KSampleTime); thread.Suspend(); TTimeIntervalMicroSeconds time; test_KErrNone(thread.GetCpuTime(time)); TReal error = (100.0 * Abs(time.Int64() - KSampleTime)) / KSampleTime; test.Printf(_L(" time == %ld, error == %f%%\n"), time.Int64(), error); idle = error < 2.0; thread.Kill(KErrNone); thread.Logon(status); User::WaitForRequest(status); test_KErrNone(status.Int()); CLOSE_AND_WAIT(thread); if (!idle) User::After(KWaitTime); // Allow system to finish whatever it's doing totalTime += KSampleTime + KWaitTime; test(totalTime < KMaxWait); } while(!idle); }
TInt StopTimer(TTime aStartTimer) { TTime endTime; endTime.HomeTime(); TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(aStartTimer); TInt actualDuration = I64INT(duration.Int64())/1000; // in millisecond return actualDuration; }
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); }
// ----------------------------------------------------------------------------- // 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(); }
TInt CStreamControl::GetPosition(TInt64& aPos) { TInt status(KErrUnknown); TTimeIntervalMicroSeconds posInTime; status = iController.GetPosition(posInTime); if (status == KErrNone) { aPos = posInTime.Int64(); } return status; }
TInt CStreamControl::GetDuration(TInt64& aDuration) { TInt status(KErrUnknown); TTimeIntervalMicroSeconds duration; status = iController.GetDuration(duration); if (status == KErrNone) { aDuration = duration.Int64(); } return status; }
TInt64 TimeUtils::GetFiletime(TTime aSymbianTime) { _LIT(KInitialTime,"16010000:000000"); TTime initialTime; initialTime.Set(KInitialTime); TTimeIntervalMicroSeconds interval; interval=aSymbianTime.MicroSecondsFrom(initialTime); return interval.Int64()*10; }