本文整理汇总了C++中TTimeIntervalSeconds类的典型用法代码示例。如果您正苦于以下问题:C++ TTimeIntervalSeconds类的具体用法?C++ TTimeIntervalSeconds怎么用?C++ TTimeIntervalSeconds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTimeIntervalSeconds类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: E32Main
GLDEF_C TInt E32Main()
{
CTrapCleanup* cleanup;
cleanup=CTrapCleanup::New();
__UHEAP_MARK;
test.Title();
test.Start(_L("Starting tests..."));
TTime timerC;
timerC.HomeTime();
DoTests();
TTime endTimeC;
endTimeC.HomeTime();
TTimeIntervalSeconds timeTakenC;
TInt r=endTimeC.SecondsFrom(timerC,timeTakenC);
test(r==KErrNone);
test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
test.End();
test.Close();
__UHEAP_MARKEND;
delete cleanup;
return(KErrNone);
}
示例2: RunL
void CPosition::RunL()
{
TPosition position;
iPositionInfo.GetPosition(position);
TTime now;
now.UniversalTime();
TTimeIntervalSeconds interval = 0;
now.SecondsFrom(position.Time(), interval);
LOGARG("Interval between retrieved position and current time: %d secs", interval.Int());
// Compare that retrieved data is not outdated
if (iStatus == KErrNone && interval.Int() < 300)
{
iObserver.PositionUpdateL(iStatus.Int(), position);
}
else if (iStatus == KErrTimedOut)
{
iObserver.PositionUpdateL(iStatus.Int(), position);
}
else
{
iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus);
SetActive();
iState = EGps;
}
}
示例3: INFO_PRINTF1
void CT_RMobileCallData::DoCmdGetCallDuration(const TTEFFunction& aSection)
{
INFO_PRINTF1(_L("*START*CT_RMobileCallData::DoCmdGetCallDuration"));
TInt callNameParameter;
if ( !GetIntFromConfig(aSection, KCallName, callNameParameter ))
{
ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCallName);
SetBlockResult(EFail);
}
else
{
INFO_PRINTF1(_L("Getting mobile call"));
TRAPD( error, iMobileCall = GetMobileCallL(callNameParameter) );
if(error != KErrNone)
{
ERR_PRINTF2(_L("GetMobileCallL left when trying to obtain the MobileCall with error %d"), error);
SetBlockResult(EFail);
}
else
{
TTimeIntervalSeconds duration = 0;
error = iMobileCall->GetCallDuration(duration);
if(error != KErrNone)
{
ERR_PRINTF2(_L("Failed to get call duration with error %d"), error);
SetError(error);
}
else
{
INFO_PRINTF3(_L("Call %d duration was %d seconds"), callNameParameter, duration.Int());
}
}
}
INFO_PRINTF1(_L("*END*CT_RMobileCallData::DoCmdGetCallDuration"));
}
示例4: CALLSTACKITEM_N
TUint CTupleStoreImpl::PutL(TTupleType aTupleType, const TTupleName& aTupleName, const TDesC& aSubName,
const TComponentName& aComponent,
const TDesC8& aSerializedData, TBBPriority aPriority, TBool aReplace,
const TTime& aLeaseExpires, TBool aKeepExisting)
{
CALLSTACKITEM_N(_CL("CTupleStoreImpl"), _CL("PutL"));
if (aTupleName.iModule.iUid == KBBAnyUidValue ||
aTupleName.iId == KBBAnyId ||
aComponent.iModule.iUid == KBBAnyUidValue ||
aComponent.iId == KBBAnyId) User::Leave(KErrArgument);
TUint ret;
{
TAutomaticTransactionHolder ath(*this);
TBool exists=SeekNameL(aTupleType, aTupleName, aSubName);
if (exists && aKeepExisting) {
UpdateL();
iTable.SetColL(ELeaseExpires, aLeaseExpires);
MDBStore::PutL();
return 0;
} else if (exists && aReplace) {
UpdateL();
} else {
InsertL();
iTable.SetColL(ETupleType, aTupleType);
iTable.SetColL(ENameModule, aTupleName.iModule.iUid);
iTable.SetColL(ENameId, aTupleName.iId);
iTable.SetColL(ENameSubName1, aSubName);
iTable.SetColL(ENameSubName2, aSubName.Left(iSubNameIndexLength));
iTable.SetColL(EPriority, aPriority);
iTable.SetColL(EComponentModule, aComponent.iModule.iUid);
iTable.SetColL(EComponentId, aComponent.iId);
}
ret=iTable.ColUint(ETupleId);
if (aSerializedData.Length() > 0) {
RADbColWriteStream w; w.OpenLA(iTable, EData);
w.WriteUint32L(aSerializedData.Length());
w.WriteL(aSerializedData);
w.CommitL();
} else {
iTable.SetColNullL(EData);
}
iTable.SetColL(ELeaseExpires, aLeaseExpires);
MDBStore::PutL();
}
if (aLeaseExpires < iNextExpiry) {
TTime now=GetTime();
TTimeIntervalSeconds s;
aLeaseExpires.SecondsFrom(now, s);
TInt wait=s.Int();
iTimer->Wait(wait);
}
return ret;
}
示例5: as_time_t
GLDEF_C time_t as_time_t(const TTime& t)
{
TTimeIntervalSeconds res;
TInt err = t.SecondsFrom(UNIX_BASE, res);
if (err)
return -1;
else
return res.Int();
}
示例6: toLocal
/*
Intended Usage: Utility routine for converting from UTC to localtime.
*/
inline time_t toLocal (const time_t aUniversalTime)
{
#ifndef __SERIES60_MRT_1_0
TTimeIntervalSeconds offset = User::UTCOffset();
return aUniversalTime + offset.Int();
#else
TLocale locale;
return aUniversalTime + locale.UniversalTimeOffset().Int();
#endif //__SERIES60_MRT_1_0
}
示例7: End
void TTestTimer::End()
{
iEnd.HomeTime();
TTimeIntervalSeconds timeTaken;
iEnd.SecondsFrom(iStart, timeTaken);
TUint totalTime = timeTaken.Int();
test.Printf(_L("Time taken is %dHrs:%dmins:%dsecs\n"),
totalTime/3600,
(totalTime/60)%60,
totalTime%60);
}
示例8: WriteToLog
void CMemoryUsageLogger::WriteToLog()
{
//seconds passed since start of application
TTime currentTime;
TTimeIntervalSeconds seconds;
currentTime.UniversalTime();
currentTime.SecondsFrom(iStartTime, seconds);
if (seconds.Int() <= 60)
{
TInt heapTotal = 0;
TInt heapAvail = 0;
TInt chunkTotal = 0;
TInt chunkAvail = 0;
TInt cellsTotal = 0;
TInt cellsAvail = 0;
TInt heapStackTotal = 0;
TInt ramTotal = 0;
TInt ramAvail = 0;
//get system memory info from hardware abstraction layer
HAL::Get(HAL::EMemoryRAM, ramTotal);
HAL::Get(HAL::EMemoryRAMFree, ramAvail);
//get process UID
TSecureId processUid(iProcess.SecureId());
//get various heap and chunk memory sizes
iHeap.AllocSize(heapTotal);
if (heapTotal > iMaxHeapTotal)
{
iMaxHeapTotal = heapTotal;
}
iHeap.Available(heapAvail);
chunkTotal = iHeap.Size();
chunkAvail = chunkTotal - heapTotal;
if (chunkTotal > iMaxChunkTotal)
{
iMaxChunkTotal = chunkTotal;
}
//get cells info
cellsTotal = iHeap.Count(cellsAvail);
//sum up the total heap and stack sizes
heapStackTotal = heapTotal + iStackSize;
//create log text and write to log file
TBuf16<KLbsDevLogMaxBufSize> logData;
logData.Format(KLogFormat, seconds.Int(), processUid.iId, iStackSize, heapTotal, heapAvail, chunkTotal, chunkAvail, cellsTotal, cellsAvail, heapStackTotal, ramTotal, ramAvail);
iLogger.Write(logData);
}
}
示例9: AddToPyDict
void AddToPyDict(python_ptr<PyObject> &dict, char* name, const TTime& value)
{
TDateTime epoch; epoch.Set(1970, EJanuary, 0, 0, 0, 0, 0);
TTime e(epoch);
TInt unixtime=0;
TTimeIntervalSeconds secs;
if (value!=TTime(0)) {
User::LeaveIfError(value.SecondsFrom(e, secs));
unixtime=secs.Int();
}
AddToPyDict(dict, name, unixtime);
}
示例10: switch
void CLogMonitor::RunL()
{
if(iStatus != KErrCancel)
switch(iState)
{
case EWaitingChange:
// if this doesn't appear to catch the event right
// you could try sleeping a bit before fetching the event...
// User::After(2000000);
GetLatest();
break;
case EReadingLog:
if(iRecentLogView)
{
if(iRecentLogView->CountL() > 0)
GetFirstEventL();
else
StartMonitorL();
}
break;
case EReadingFirstLog:
case EReadingLogItems:
if(iStatus == KErrNone && iRecentLogView)
{
TLogFlags iFlags = iRecentLogView->Event().Flags();
if( !( iFlags & KLogEventRead ) )
{
const CLogEvent& ev=iRecentLogView->Event();
TTimeIntervalSeconds secs;
ev.Time().SecondsFrom(iLastTime,secs);
iLastTime=iRecentLogView->Event().Time();
qDebug()<<"secs"<<secs.Int();
if (abs(secs.Int())>0) iCallBack->LogEventL(ev);
}
//GetNextEventL();
StartMonitorL();
}
else
StartMonitorL();
break;
case EDeletingEvent:
GetNextEventL();
break;
default:
StartMonitorL();
break;
}
}
示例11: OPENG_DP
// ---------------------------------------------------------------------------
// TPresCondValidity::FormatToXMLTimeStringL()
// ---------------------------------------------------------------------------
//
TInt TPresCondValidity::FormatToXMLTimeStringL(TDes& aXMLTimeString,
const TTime aUTCDateTime)
{
OPENG_DP(D_OPENG_LIT( " TPresCondValidity::FormatToXMLTimeString()" ) );
OPENG_DP(D_OPENG_LIT( " FormatToXMLTimeString aUTCDateTime:"));
LogDateTime(aUTCDateTime.DateTime());
// Initializing the locale
TLocale myLocale, systemLocale;
myLocale.Refresh();
systemLocale.Refresh();
myLocale.SetDateFormat(EDateJapanese);
myLocale.SetDateSeparator('-',1);
myLocale.SetDateSeparator('-',2);
myLocale.SetDateSeparator('T',3);
myLocale.SetTimeFormat(ETime24);
myLocale.SetTimeSeparator(':',1);
myLocale.SetTimeSeparator(':',2);
myLocale.SetTimeSeparator(' ',3);
myLocale.Set();
// getting UTC difference
TTimeIntervalSeconds uTCseconds = systemLocale.UniversalTimeOffset();
// processing main time and date component
TTime mainTTime = aUTCDateTime + uTCseconds;
mainTTime.FormatL(aXMLTimeString, KPresDateTimeFormatString);
// Processing for time difference
TChar uTCtimeSign('+');
TDateTime myUTCtime(0,EJanuary,0,0,0,0,0);
TTime uTCTTime(myUTCtime);
if(uTCseconds.Int()<0)
{
uTCtimeSign = '-';
uTCseconds = (uTCseconds.Int())*(-1);
}
uTCTTime = uTCTTime + uTCseconds;
TBuf<KPresDateTimeBufLength> dateTimeUTCBuffer;
uTCTTime.FormatL(dateTimeUTCBuffer, KPresUTCFormatString);
// Appending the time difference to main string
aXMLTimeString.Append(dateTimeUTCBuffer);
// put time difference sign to main string
aXMLTimeString[23] = uTCtimeSign;
// putting the system locale back
systemLocale.Set();
return KErrNone;
}
示例12: FEP
/**
@SYMTestCaseID UIF-FEPTEST-0001
@SYMPREQ 0000
@SYMTestCaseDesc Launch the application and offer events.
@SYMTestPriority High
@SYMTestStatus Implemented
@SYMTestActions Launch an application with the editor window. The application is made to exit, when a timer expires.
Load the FEP (TFEP1). Create character codes for text events. Offer the texts to the applciation for
the TFEP1 to intercept.
A succesful implementation ensures that the application exits without a crash.
Here the layout of the FEP UI is such that the Composition Window is integrated into the Target Control.
@SYMTestExpectedResults The test case fails if the app crashed with an exception and passes if the app exits cleanly
*/
void CDefocusingEdwinUi::RunTestStepL(TInt aStep)
{
User::After(TTimeIntervalMicroSeconds32(1));
TTimeIntervalSeconds theInterval;
TTime tm;
tm.HomeTime();
tm.SecondsFrom(iTmStart,theInterval);
TInt theInt = theInterval.Int();
if(iCurrentSecond < theInt)
{
if(KNumberOfSeconds-iCurrentSecond < 0)
{
iCoeEnv->InstallFepL(KNullUid);
AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
return;
}
else
{
TBuf<100> message;
message.Format(_L("%d seconds remaining"), KNumberOfSeconds-iCurrentSecond);
User::InfoPrint(message);
iCurrentSecond = theInt;
}
}
TWsEvent theEvent;
TKeyEvent *theKey = theEvent.Key();
theKey->iScanCode = 0;
theKey->iModifiers= 0;
theKey->iRepeats=0;
theKey->iCode = 'A';
TInt nRes = aStep % 7;
if(nRes == 6)
{
theKey->iCode = EKeyEnter;
}
else
{
theKey->iCode += nRes;
}
INFO_PRINTF2(_L("Simulate Key Event with code %d"), theKey->iCode);
SendEventToWindowGroups(theEvent);
}
示例13: DRMLOG
// ------------------------------------------------------------------------
// CDRMConsume::DoCancelL
// ------------------------------------------------------------------------
//
void CDRMConsume::DoCancelL()
{
DRMLOG( _L( "CDRMConsume::DoCancelL" ) );
if ( iCurrentDelay )
{
TTimeIntervalSeconds secs;
TTime trustedTime;
TBool secureTime;
CTimer::DoCancel();
secureTime = SECURETIME( trustedTime );
trustedTime.SecondsFrom( iTime, secs );
#ifdef RD_DRM_METERING
// Update total cumulative time for content metering purposes
iTotalCumulativeTime = iTotalCumulativeTime.Int() + secs.Int();
#endif
// If the top level timed counter has not been activated yet
// increment the counter
if( ISSET( iTimedCounts, KChildToplevelCount ) )
{
iCumulativeDelayTop = iCumulativeDelayTop.Int() + secs.Int();
}
// If the child timed counter has not been activated yet
// increment the counter
if( ISSET( iTimedCounts, KChildPermCount ) )
{
iCumulativeDelayChild = iCumulativeDelayChild.Int() + secs.Int();
}
// Always >= 0.
ConsumeTimedItemsL( secs,
secureTime,
trustedTime );
iCurrentDelay = 0;
}
UpdateDBL();
if ( SERVER->HasActiveCountConstraint( *iURI ) )
{
SERVER->RemoveActiveCountConstraint( *iURI );
}
DRMLOG( _L( "CDRMConsume::DoCancel ok" ) );
}
示例14: ComputeChecksum
// -----------------------------------------------------------------------------
// CTransactionIDGenerator::AddSystemInfo
// -----------------------------------------------------------------------------
//
void CTransactionIDGenerator::AddSystemInfo( TDes8& aBuf ) const
{
TInt biggestBlock = 0;
TInt totalAvailable = User::Available( biggestBlock );
TInt value = biggestBlock + totalAvailable - User::CountAllocCells();
ComputeChecksum( aBuf, &value, sizeof( value ) );
TTimeIntervalSeconds inactivity = User::InactivityTime();
if ( inactivity.Int() > 0 )
{
TUint8 byteVal = static_cast<TUint8>( inactivity.Int() & 0xff );
aBuf.Append( &byteVal, sizeof( byteVal ) );
}
}
示例15: SymbianToDateTime
datetime_t SymbianToDateTime(TTime Time)
{
// reference is 1st January 2001 00:00:00.000 UTC
datetime_t Date = INVALID_DATETIME_T;
TTime Reference(ToInt64(LL(0x00e05776f452a000)));
TTimeIntervalSeconds Diff;
if (Time.SecondsFrom(Reference,Diff) == KErrNone)
{
Date = Diff.Int();
if (Date==INVALID_DATETIME_T) ++Date;
}
return Date;
}