本文整理汇总了C++中TTime类的典型用法代码示例。如果您正苦于以下问题:C++ TTime类的具体用法?C++ TTime怎么用?C++ TTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TTimeIntervalMicroSecondsToTBMNs
TBMNs TBMTimeInterval::EndNs()
{
//
// Now, in the reverse order
//
TBMTicks stamp;
::bmTimer.Stamp(&stamp);
TTime time;
time.HomeTime();
TBMNs ns = TTimeIntervalMicroSecondsToTBMNs(time.MicroSecondsFrom(iTime));
//
// If the interval fits in the high-precision timer period we can use it;
// otherwise, use the low-precision timer.
//
if (ns < iStampPeriodNs)
{
stamp = TBMTicksDelta(iStamp, stamp);
::bmTimer.TicksToNs(&stamp, &ns);
}
return ns;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:21,代码来源:bm_main.cpp
示例2: CreateScheduleL
void CMsvScheduleSend::CreateScheduleL(const TTime& aTime, const TTimeIntervalMinutes& aValidityPeriod, const CArrayFixFlat<TTaskSchedulerCondition>& aSchConditions, TBool aPendingConditions, TSchedulerItemRef& aRef)
{
if( aPendingConditions )
{
CreateScheduleL(iScheduler, aSchConditions, aTime, aRef);
#ifndef _MSG_NO_LOGGING
TBuf<32> bufDate;
aTime.FormatL(bufDate, _L("%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"));
SCHSENDLOG(FLog(_L("\tCreated Schedule %d for pending %d conditions or %S"), aRef.iHandle, aSchConditions.Count(), &bufDate));
#endif
}
else
{
CreateScheduleL(iScheduler, *iSettings, aTime, aValidityPeriod, aRef);
#ifndef _MSG_NO_LOGGING
TBuf<32> bufDate;
aTime.FormatL(bufDate, _L("%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B"));
SCHSENDLOG(FLog(_L("\tCreated Schedule %d for %S"), aRef.iHandle, &bufDate));
#endif
}
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:21,代码来源:MsvScheduleSend.cpp
示例3: dt
EXPORT_C void CMsvScheduleSend::RoundUpToMinute(TTime& aTime)
{
TDateTime dt(aTime.DateTime());
if (dt.MicroSecond() != 0 || dt.Second() != 0)
{
dt.SetMicroSecond(0);
dt.SetSecond(0);
aTime = dt;
aTime += (TTimeIntervalMinutes) 1;
}
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:12,代码来源:MsvScheduleSend.cpp
示例4: Cancel
// -----------------------------------------------------------------------------
// CCbsMessageCleanupTimer::StartTimer
// Starts the clean up timer.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CCbsMessageCleanupTimer::StartTimer()
{
// Cancel a pending request
if ( IsActive() )
{
Cancel();
}
// Get the current time
TTime now;
now.HomeTime();
if ( iInterval.Int() > 0 )
{
TTime nextCleanup( 0 );
nextCleanup = now + iInterval;
// Start the timer
At( nextCleanup );
}
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:27,代码来源:CCbsMessageCleanUpTimer.cpp
示例5: DataStreamTimeStampBeginL
EXPORT_C void CMemSpyEngineOutputSink::DataStreamTimeStampBeginL( const TTime& aTime )
{
const TDateTime dt( aTime.DateTime() );
// Build it up...
HBufC* spec = HBufC::NewL( KMaxFileName );
TPtr pName( spec->Des() );
pName.Format( KMemSpyDataStreamFolderNameFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second());
DataStreamTimeStampEnd();
iDataStreamTimeStampSpecifier = spec;
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:12,代码来源:MemSpyEngineOutputSink.cpp
示例6: Accessed
// -----------------------------------------------------------------------------
// CHttpCacheEntry::Accessed
//
// -----------------------------------------------------------------------------
//
void CHttpCacheEntry::Accessed()
{
TTime now;
now.HomeTime();
iLastAccessed = now.Int64();
iRef++;
if ( iEvictionCandidate )
{
iEvictionHandler->Accessed( *this );
}
#ifdef __CACHELOG__
_LIT( KAccessFormat, "entry accessed: %d" );
TBuf<100> buf;
buf.Format( KAccessFormat, iRef );
HttpCacheUtil::WriteUrlToLog( 0, buf, iUrl->Des() );
#endif // __CACHELOG__
}
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:26,代码来源:HttpCacheEntry.cpp
示例7: IsBefore
/*
-------------------------------------------------------------------------
-------------------------------------------------------------------------
*/
TBool CExPolicy_Server::IsTimeBeforeL(TTime& aTime,TTime& aCompare)
{
TBool IsBefore(EFalse);
TTimeIntervalMinutes MinInterval(0);
TTimeIntervalHours HourInterval(0);
TTimeIntervalSeconds SecInterval(0);
TTime TimeNow;
TimeNow.HomeTime();
TTimeIntervalDays DaysInterval = aTime.DaysFrom(aCompare);
if(DaysInterval.Int() <= 0)
{
aTime.HoursFrom(aCompare,HourInterval);
if(HourInterval.Int() <= 0)
{
aTime.MinutesFrom(aCompare,MinInterval);
if(MinInterval.Int() <= 0)
{
aTime.SecondsFrom(aCompare, SecInterval);
if(SecInterval.Int() <= 0)
{
IsBefore = ETrue;
}
}
}
}
return IsBefore;
}
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:34,代码来源:ExampleServer.cpp
示例8: busyInterval
void CBusyTestUnit::ThreadFunction()
{
// this runs in a separate thread and tries to use lots of CPU time up to percentage
// nominally we run busy for loops for iPercentBusy/100ms, and then wait for rest of the
// 100ms using User::After(). We keep doing this until we reach the target time, if there is
// one
const TInt KDefaultLoop = 10000;
TTime timeAtStart;
timeAtStart.UniversalTime(); // time of start
const TInt KLoopInterval =100000; // 100ms - loop time
TTimeIntervalMicroSeconds32 busyInterval(KLoopInterval*iPercentBusy/100); // how much of loop time to be busy
TTimeIntervalMicroSeconds32 quietInterval(KLoopInterval-busyInterval.Int()); // how much of loop time to be quiet
while (ETrue)
{
// the interval, for loops for the busy bit and then a User::After()
TTime startOfInterval;
startOfInterval.UniversalTime();
while (ETrue)
{
// the busy bit - iBusyVariable is volatile so should never be optimised out
for (TInt i=0; i<KDefaultLoop; i++)
{
iBusyVariable = i;
}
TTime now;
now.UniversalTime();
if (startOfInterval + busyInterval < now)
{
// we're passed the time
break;
}
}
User::After(quietInterval);
if (iRunFor.Int64())
{
// check to see if we are passed the interval given at Start()
TTime now;
now.UniversalTime();
if (timeAtStart + iRunFor < now)
{
// we're passed the time
break;
}
}
}
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:50,代码来源:TestStep.cpp
示例9: new
void CPhoneWatcher::DoRetrieveTSYNameL()
{
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
CMDBSession* db = CMDBSession::NewL(KCDVersion1_2);
#else
CMDBSession* db = CMDBSession::NewL(KCDVersion1_1);
#endif
CleanupStack::PushL(db);
CMDBField<TUint32>* globalSettingsField = new(ELeave) CMDBField<TUint32>(KCDTIdModemPhoneServicesSMS);
CleanupStack::PushL(globalSettingsField);
globalSettingsField->SetRecordId(1);
globalSettingsField->LoadL(*db);
TUint32 modemId = *globalSettingsField;
CleanupStack::PopAndDestroy(globalSettingsField);
CMDBField<TDesC>* tsyField = new(ELeave) CMDBField<TDesC>(KCDTIdTsyName);
CleanupStack::PushL(tsyField);
tsyField->SetRecordId(modemId);
tsyField->SetMaxLengthL(KMaxTextLength);
tsyField->LoadL(*db);
iTSYName = *tsyField;
CleanupStack::PopAndDestroy(tsyField);
// Strip any file extension
TInt pos = iTSYName.LocateReverse('.');
if (pos >= 0)
iTSYName = iTSYName.Left(pos);
#ifdef WATCHER_TESTING
{
TTime now;
now.UniversalTime();
User::LeaveIfError(RProperty::Set(KUidSystemCategory, KUidTestProp_ModemTableRefreshed.iUid, I64LOW(now.Int64())));
}
#endif
CleanupStack::PopAndDestroy(); // db or commsDatabase
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:40,代码来源:watcherbase.cpp
示例10: GetDatePacked
bool_t GetDatePacked(datetime_t t, datepack_t *tp, bool_t Local)
{
TDateTime Date;
TTime ot;
if (!tp || t == INVALID_DATETIME_T) return 0;
ot = DateTimeToSymbian(t);
if (Local)
{
#ifndef SYMBIAN90
TLocale locale;
TTimeIntervalSeconds universalTimeOffset(locale.UniversalTimeOffset());
ot += universalTimeOffset;
if (locale.QueryHomeHasDaylightSavingOn())
{
TTimeIntervalHours daylightSaving(1);
ot += daylightSaving;
}
#else
RTz TzServer;
if (TzServer.Connect()==KErrNone)
{
CTzConverter* Converter = CTzConverter::NewL(TzServer);
Converter->ConvertToLocalTime(ot);
delete Converter;
TzServer.Close();
}
#endif
}
Date = ot.DateTime();
tp->Year = Date.Year();
tp->Month = (int)Date.Month() + 1;
tp->Day = Date.Day()+1;
tp->Hour = Date.Hour();
tp->Minute = Date.Minute();
tp->Second = Date.Second();
return 1;
}
开发者ID:ViFork,项目名称:ResInfo,代码行数:40,代码来源:date_symbian.cpp
示例11: TestBKLastModifiedTimeL
LOCAL_D void TestBKLastModifiedTimeL ()
{
TTime currentTime;
RBkDatabase db;
db.OpenL ();
CleanupClosePushL ( db );
// Create a new folder.
RBkFolder folder = db.CreateFolderL ( KMyFolder );
CleanupClosePushL ( folder );
folder.SetDescriptionL ( KMyFolderDesc );
db.CommitL(); // Commit the transaction.
User::After ( KGeneralDelay );
currentTime.HomeTime ();
gTestWrapper->TEST( folder.LastModifiedL() < currentTime ); // Creation time.
TTime newTime;
newTime.HomeTime ();
TRAPD( err, folder.SetLastModifiedL( newTime ) );
// Should leave with KErrPermissionDenied error
gTestWrapper->TESTE( err == KErrPermissionDenied, err );
CleanupStack::PopAndDestroy ( &folder ); // destroy/close
// Open the above created folder.
folder = db.OpenFolderL ( KMyFolder );
CleanupClosePushL ( folder );
folder.SetDescriptionL ( KMyFolderNewDesc );
db.CommitL ();
User::After ( KGeneralDelay );
currentTime.HomeTime ();
gTestWrapper->TEST( folder.LastModifiedL() < currentTime ); // Save time.
Bookmark::TItemId id = folder.Id();
CleanupStack::PopAndDestroy ( &folder );
db.DeleteItemL ( id ); // mark for deleting
db.CommitL ();
CleanupStack::PopAndDestroy ( &db );
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:40,代码来源:tfoldertests.cpp
示例12: testRFileSetModified
static void testRFileSetModified(TDateTime* aDateTime, TTime* aTime, TBool validDate)
//
// Test RFile::SetModified() and RFile::Modified()
//
{
RFile file;
TInt r=file.Replace(TheFs,_L("Y2KTEST.tst"),0);
test_Value(r, r == KErrNone || r==KErrPathNotFound);
r=file.SetModified(*aTime);
test_KErrNone(r);
file.Close();
TTime check;
file.Open(TheFs,_L("Y2KTEST.tst"),EFileWrite);
r=file.Modified(check);
test_KErrNone(r);
file.Close();
TDateTime checkDateTime=check.DateTime();
test(checkDateTime.Year()==aDateTime->Year());
if (validDate)
{
test(checkDateTime.Month()==aDateTime->Month());
test(checkDateTime.Day()==aDateTime->Day());
}
else
{
test(checkDateTime.Month()==aDateTime->Month()+1);
test(checkDateTime.Day()==0);
}
check.FormatL(gDateBuf,_L("%*D%X%N%Y %1 %2 %3"));
test.Printf(_L("Valid date: %S\n"),&gDateBuf);
r=TheFs.Delete(_L("Y2KTEST.tst"));
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:39,代码来源:t_fsy2k.cpp
示例13: TestAll
/** Creates files
@param aSelector Configuration in case of manual execution
*/
LOCAL_C TInt TestAll(TAny* aSelector)
{
TInt r = 0;
TTime startTime;
TTime endTime;
TTimeIntervalSeconds timeTaken;
Validate(aSelector);
gFormat = EFalse; // The card won't be formatted after this test execution
startTime.HomeTime();
TestFileCreate(aSelector);
endTime.HomeTime();
r = endTime.SecondsFrom(startTime, timeTaken);
FailIfError(r);
test.Printf(_L("#~TS_Timing_%d,%d=%d\n"), gTestHarness, gTestCase, timeTaken.Int());
return KErrNone;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:26,代码来源:t_fsrcreatefiles.cpp
示例14: ResourceLeakTest
CIpuTestHarness::~CIpuTestHarness()
//
// D'tor
{
TTime endtime;
endtime.UniversalTime();
// Do resource handle leak test?
if (iDoResourceLeakTest)
ResourceLeakTest();
// End of tests - see if failed or ok
if (iFailedTests->Count())
{
TestHarnessFailed();
}
else
{
TestHarnessComplete();
}
iFailedTests->ResetAndDestroy();
delete iFailedTests;
// Log finish time
TDateTime t = endtime.DateTime();
LogIt(_L("Ended @ %d:%d:%d:%d"),t.Hour(),t.Minute(),t.Second(),t.MicroSecond());
TTime difftime(endtime.Int64() - iStartTime.Int64());
t = difftime.DateTime();
LogIt(_L("Execution time %d:%d:%d:%d"),t.Hour(),t.Minute(),t.Second(),t.MicroSecond());
// Close logs and test harness
iFlogger.CloseLog();
// iTest test harness performs UHEAP MARK/UNMARK check upon creation/destruction
// therefore, it must be destroyed last since it is created first in
// CIpuTestHarness
iTest.Close();
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:39,代码来源:IpuTestHarness.cpp
示例15: OPENG_DP
// ---------------------------------------------------------------------------
// TPresCondValidity::ConvertToLocal()
// ---------------------------------------------------------------------------
//
void TPresCondValidity::ConvertToLocal(TTime& aDateTime)
{
OPENG_DP(D_OPENG_LIT( " TPresCondValidity::ConvertToLocal()" ) );
OPENG_DP(D_OPENG_LIT( " ConvertToLocal aDateTime:"));
LogDateTime(aDateTime.DateTime());
TLocale myLocale;
myLocale.Refresh();
// getting UTC difference
TTimeIntervalSeconds uTCseconds = myLocale.UniversalTimeOffset();
aDateTime = aDateTime + uTCseconds;
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:17,代码来源:prescondvalidity.cpp
示例16: ShuffleL
void CSTAnnounceList::ShuffleL()
{
TTime now;
now.HomeTime();
TInt64 seed = now.Int64();
for (TInt i=0; i<iTiers.Count(); i++)
{
TInt addressCount = iTiers[i]->MdcaCount();
if (addressCount > 1)
for (TInt j=0; j<addressCount; j++)
{
TInt pos = TInt(Math::Rand(seed)) % (addressCount-1);
HBufC8* address = (*iTiers[i])[j].AllocLC();
iTiers[i]->Delete(j);
iTiers[i]->InsertL(pos, *address);
CleanupStack::PopAndDestroy(); // address
}
}
}
开发者ID:Nokia700,项目名称:SymTorrent,代码行数:22,代码来源:STAnnounceList.cpp
示例17: MPX_FUNC
// ----------------------------------------------------------------------------
// MPXDbUtil::DayNoInWeek
// ----------------------------------------------------------------------------
//
TInt MPXDbUtil::DayNoInWeek()
{
MPX_FUNC("MPXDbUtil::DayNoInWeek");
TTime now; // in microseconds
now.HomeTime();
// Calculate number of days in this week
TDay dayNo = now.DayNoInWeek();
TDay firstDay = TLocale().StartOfWeek();
TInt numDay(0);
if (firstDay == ESunday)
{
numDay = dayNo + 1;
}
else
{
numDay = dayNo - firstDay;
}
return numDay;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:26,代码来源:mpxdbutil.cpp
示例18: Start
void CTimeout::Start(TInt64 aTime)
{
// TRACE_FUNCF((_L("aTime=%d iTime=%d"), aTime, iTime));
// LOG_DEBUGF((_L("start timer aTime=%d iTime=%d"), aTime, iTime));
if (aTime != 0)
{
iTime = aTime;
}
if (iTime < 2100000)
{
iTimer.After(iStatus, iTime * 1000);
}
else
{
TTime time;
time.HomeTime();
TTimeIntervalMicroSeconds delta = iTime * 1000;
time += delta;
iTimer.At(iStatus, time);
}
SetActive();
}
开发者ID:Nokia700,项目名称:SymTorrent,代码行数:22,代码来源:Timeout.cpp
示例19: DLTRACEIN
MNcdNode::TState CNcdNodeProxy::State() const
{
DLTRACEIN((_L("Node namespace=%S, id=%S"), &Namespace(), &Id() ));
// Check if the link handle has been set, which means that also
// link data has been internalized. Also, check if the metadata
// exists, which means that metadata has also been internalized.
if ( LinkHandleSet()
&& iMetadata != NULL )
{
DLINFO(("State was initialized"));
// If state was initialized we have to check if the state
// has acutally expired already
TTime now;
now.HomeTime();
DLINFO(("now time: %d", now.Int64() ));
DLINFO(("expired time: %d", ExpiredTime().Int64() ));
// We can just compare the times here. Server side
// inserts the maximum value for the expired time if the
// protocol has set never expire value for the validity delta.
if ( now > ExpiredTime() )
{
DLTRACEOUT(("Expired"));
return MNcdNode::EStateExpired;
}
DLTRACEOUT(("Initialized"));
return MNcdNode::EStateInitialized;
}
else
{
// Node has not been initialized.
DLTRACEOUT(("Not initialized"));
return MNcdNode::EStateNotInitialized;
}
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:38,代码来源:ncdnodeproxy.cpp
示例20: Fail
void CTestPerf::ReadComplete(TInt aStatus)
{
if (iTrace)
Test.Printf(_L("CTestPerf::ReadComplete(%d) len = %d/%d\r\n"), aStatus, iWriter->iDes.Length(), iWriter->iDes.MaxLength());
if (aStatus!=KErrNone)
{
Fail(ETestFailRead, aStatus);
return;
}
switch (iState)
{
case EWaitIO:
iRetries = 0;
iTimer->Cancel();
iCount += iReader->iCount;
iPackets++;
{
TTime end;
end.UniversalTime();
TInt64 difftime = (end.MicroSecondsFrom(iStartTime).Int64()+TInt64(500000))/TInt64(1000000);
if (difftime==0)
difftime = 1;
TInt64 cps = MAKE_TINT64(0,iCount)/difftime;
TInt rate = (I64INT(cps)*10000)/11520;
iRate += rate;
iSpeed += I64INT(cps);
Test.Printf(_L("%c %6d %d (%dbps=%d.%02d%%)\r"), KSpinner[iSpin++ & 3], iPackets, iCount, iSpeed/iPackets, (iRate/iPackets)/100, (iRate/iPackets)%100);
}
Read();
break;
default:
break;
}
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:38,代码来源:t_loop.cpp
注:本文中的TTime类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论