Beispiel #1
0
//
/// Construct TTime with current time (seconds since Jan 1, 1901).
//
TTime::TTime()
{
#if 0
  time_t ltime;
  time(&ltime);
  struct tm *t = localtime(&ltime);

  // Construct the date.  The time struct returns int, so casts are used.
  //
  TDate today( (DayTy)t->tm_mday,
               (MonthTy)(t->tm_mon + 1),
               (YearTy)t->tm_year );// +1900 //????????

  *this = TTime( today,
                 (HourTy)t->tm_hour,
                 (MinuteTy)t->tm_min,
                 (SecondTy)t->tm_sec );
#else
  TSystemTime _clk(TSystemTime::LocalTime());
  *this = TTime(TDate(_clk), 
                _clk.GetHour(), 
                _clk.GetMinute(), 
                _clk.GetSecond());
#endif
}
// ---------------------------------------------------------
// CT_LbsTestTimerPsy::NotifyPositionUpdate
// 
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsTestTimerPsy::NotifyPositionUpdate(
	TPositionInfoBase& aPosInfo,
    TRequestStatus& aStatus)
	{
    TPositionInfo* position = NULL;
    position = static_cast<TPositionInfo*> (&aPosInfo);
    iStatus = &aStatus;
    *iStatus = KRequestPending;

  	TUid implUid = { KPosImplementationUid };
	position->SetModuleId(implUid);

    if (iTrackingEnabled)
        {
        // Set this position when tracking is enabled (on-going)
        TCoordinate coor(55.0, 55.0, 55.0);
        TLocality loc (coor, 1.0, 1.0);
        TPosition pos (loc, TTime(0));
        position -> SetPosition(pos);
        }
    else
        {
	    // Set a dummy position
        TCoordinate coor(20.0, 20.0, 20.0);
        TLocality loc (coor, 1.0, 1.0);
        TPosition pos (loc, TTime(0));
        position -> SetPosition(pos);

        User::RequestComplete(iStatus, KErrNone);
        }
    }
void CBadRRule::CreateChild2L()
{
	TInt num ;
	
	TCalTime rec2 ;
	rec2.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 16, 10, 1, 0, 0))) ; //Jan 17

	HBufC8* guid_c2 = KGUID().AllocLC(); // ownership of guid1 gets transferred
	CCalEntry *entry_c2 = CCalEntry::NewL(CCalEntry::EEvent, guid_c2, CCalEntry::EMethodNone, 0, rec2, CalCommon::EThisAndAll);
	CleanupStack::Pop(guid_c2);
	CleanupStack::PushL(entry_c2) ;	

	TCalTime startTime_c2 ;
	TCalTime endTime_c2 ;	
	startTime_c2.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 8, 11, 2, 0, 0))) ;
	endTime_c2.SetTimeUtcL(startTime_c2.TimeUtcL() + TTimeIntervalHours(1)) ;
	entry_c2->SetStartAndEndTimeL(startTime_c2, endTime_c2) ;
	
	RPointerArray<CCalEntry> entryarr_c2 ;	
	entryarr_c2.AppendL(entry_c2) ;
	iCalEntryView->StoreL(entryarr_c2, num) ;		
	entryarr_c2.Close() ;
	
	CleanupStack::PopAndDestroy(entry_c2) ;
	
}
/**
This method calculates the horizontal speed between the current position
and the supplied instance aPosition. The speed is calculated based on the
coordinates and time associated with each instance. An estimate of the
accuracy of the result is also provided.

@param[in] aPosition is another position to use in the calculation.
@param[out] aSpeed upon successful completion, this is set to the speed 
indicated by being at this position at its recorded time, and at aPosition
at its recorded time. Always positive, in metres per second.
@param[out] aDelta upon successful completion, this is set to an estimate of the
accuracy of the calculation, in metres per second.
@return a Symbian OS error code.
@return KErrArgument if any of iLatitude, iLongitude, aPosition.iLatitude
or aPosition.iLongitude are set to NaN.
@return KErrArgument if any of iHorizontalAccuracy
or aPosition.iHorizontalAccuracy are set to NaN.
@return KErrArgument if either of iTime or aPosition.iTime are set to zero.
@return KErrArgument if iTime and aPosition.iTime are the same.
*/
EXPORT_C TInt TPosition::Speed(const TPosition& aPosition,
                               TReal32& aSpeed,
                               TReal32& aDelta) const
	{
    if (Math::IsNaN(iLatitude) ||
        Math::IsNaN(iLongitude) ||
        Math::IsNaN(iHorizontalAccuracy) ||
        Math::IsNaN(aPosition.iLatitude) ||
        Math::IsNaN(aPosition.iLongitude) ||
        Math::IsNaN(aPosition.iHorizontalAccuracy) ||
        iTime == TTime(0) ||
        aPosition.iTime == TTime(0) ||
        iTime == aPosition.iTime)
        {
        return KErrArgument;
        }

    // Calculate the distance between the positions
    TReal64 distance;
    TReal64 delta;
    RETURN_IF_ERROR(Distance64(*this, aPosition, distance, delta));

    // Calculate the speed and the speed delta between the positions
    // It is important to calculate distance/time before converting to 
    // metres per second so no division by zero occurs.
    TInt64 timeDiff = Abs(iTime.MicroSecondsFrom(aPosition.iTime).Int64());

    aSpeed = TReal32((distance / timeDiff) * 
                     KMetresPerMicroSecondToMetresPerSecond); 
    aDelta = TReal32((delta / timeDiff) * 
                     KMetresPerMicroSecondToMetresPerSecond); 

	return KErrNone;
	}
LOCAL_C void StartupUninstallL(TBool aIsSetup)
{
	if(aIsSetup)
		{
		RFs fs;
		User::LeaveIfError(fs.Connect());
		CleanupClosePushL(fs);
		CFileMan* fm = CFileMan::NewL(fs);
		CleanupStack::PushL(fm);

		// Copy rev 1 file into install dir & Reset read-only bit
		User::LeaveIfError(fm->Copy(KInstallOnlyFile, KInstallFile));
		User::LeaveIfError(fm->Attribs(KInstallFile,0,KEntryAttReadOnly,TTime(0)));

		// Cause directory listing to be written and file to be installed
		CCentRepSWIWatcher*	swiWatcher = CCentRepSWIWatcher::NewL(TServerResources::iFs);
		delete swiWatcher;

		// Create a persists file that will be deleted
		User::LeaveIfError(fm->Copy(KPersistsFileUpgraded, KInstallPersistsFile));
		User::LeaveIfError(fm->Attribs(KInstallPersistsFile,0,KEntryAttReadOnly,TTime(0)));

		TInt err=fs.Delete(KInstallFile);
		if((err!=KErrNone)&&(err!=KErrNotFound))
			User::Leave(err);

		CleanupStack::PopAndDestroy(2); // fs and fm
		}
	else
		{
		CCentRepSWIWatcher*	swiWatcher = CCentRepSWIWatcher::NewL(TServerResources::iFs);
		delete swiWatcher;
		}
}
LOCAL_C void StartupUpgradeL(TBool aIsSetup)
{
	if(aIsSetup)
		{
		// Set up files for test
		RFs fs;
		User::LeaveIfError(fs.Connect());
		CleanupClosePushL(fs);
		CFileMan* fm = CFileMan::NewL(fs);
		CleanupStack::PushL(fm);

		// Clean out files
		TInt err=fs.Delete(KInstallDirFile);
		if((err!=KErrNone)&&(err!=KErrNotFound))
			User::Leave(err);

		// Cause directory listing with no files to be written
		CCentRepSWIWatcher*	swiWatcher = CCentRepSWIWatcher::NewL(TServerResources::iFs);
		delete swiWatcher;

		User::LeaveIfError(fm->Copy(KPersistsFileNoUpgrade, KPersistsFile));
		User::LeaveIfError(fm->Attribs(KPersistsFile,0,KEntryAttReadOnly,TTime(0)));

		User::LeaveIfError(fm->Copy(KRomUpgradeRev1File, KUpgradeFile));
		User::LeaveIfError(fm->Attribs(KUpgradeFile,0,KEntryAttReadOnly,TTime(0)));

		CleanupStack::PopAndDestroy(2); // fs and fm
		}
	else
		{
		CCentRepSWIWatcher*	swiWatcher = CCentRepSWIWatcher::NewL(TServerResources::iFs);
		delete swiWatcher;
		}
}
void CenrepSwiOOMTest::UninstallL(TBool aIsSetup)
	{
	if(aIsSetup)
		{
		// Install upgrade
		UpgradeInstallL(ETrue);
		UpgradeInstallL(EFalse);

		RFs fs;
		User::LeaveIfError(fs.Connect());
		CleanupClosePushL(fs);
		CFileMan* fm = CFileMan::NewL(fs);
		CleanupStack::PushL(fm);

		// Delete file from install dir
		User::LeaveIfError(fm->Attribs(KInstallFile,0,KEntryAttReadOnly,TTime(0)));
		TInt err=fs.Delete(KInstallFile);
		if((err!=KErrNone)&&(err!=KErrNotFound))
			User::Leave(err);

		// Create a cre persists file, doesn't matter what's in it, it should be deleted
		User::LeaveIfError(fm->Copy(KPersistsFileUpgraded, KInstallPersistsFile));
		User::LeaveIfError(fm->Attribs(KInstallPersistsFile,0,KEntryAttReadOnly,TTime(0)));

		CleanupStack::PopAndDestroy(2); // fs and fm
		}
	else
		{
		iSwiWatcher->HandleSWIEventL(ESASwisUninstall | ESASwisStatusSuccess);
		}
	}
void CBadRRule::CreateChild1L()
{
	TInt num ;
	
	TCalTime recId;

	recId.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 9, 10, 1, 0, 0))); // creating recurrence id

	HBufC8* guid1 = KGUID().AllocLC(); // ownership of guid1 gets transferred
	CCalEntry *entry1 = CCalEntry::NewL(CCalEntry::EEvent, guid1, CCalEntry::EMethodNone, 0, recId, CalCommon::EThisOnly);
	CleanupStack::Pop(guid1);			
	CleanupStack::PushL(entry1) ;	

	TCalTime startTime3 ;
	TCalTime endTime3 ;	
	startTime3.SetTimeUtcL(TTime(TDateTime(2006, EJanuary, 7, 10, 2, 0, 0))) ;
	endTime3.SetTimeUtcL(startTime3.TimeUtcL() + TTimeIntervalHours(1)) ;
	entry1->SetStartAndEndTimeL(startTime3, endTime3) ;
	
	RPointerArray<CCalEntry> entryarr1 ;	
	entryarr1.AppendL(entry1) ;
	iCalEntryView->StoreL(entryarr1, num) ;		
	entryarr1.Close() ;	
	
	CleanupStack::PopAndDestroy(entry1) ;

}
EXPORT_C void CNetworkError::ConnectionSuccessL()
{
	MSettings& sett=GetContext()->Settings();
	sett.WriteSettingL(SETTING_LAST_CONNECTION_SUCCESS, GetTime());
	sett.WriteSettingL(SETTING_LAST_CONNECTION_ATTEMPT, TTime(0));
	sett.WriteSettingL(SETTING_LAST_CONNECTION_REQUEST, TTime(0));
	sett.WriteSettingL(SETTING_LATEST_CONNECTION_REQUEST, TTime(0));
}
EXPORT_C void CNetworkError::TryingConnectionL()
{
	MSettings& sett=GetContext()->Settings();
	TTime previous=TTime(0);
	sett.GetSettingL(SETTING_LAST_CONNECTION_ATTEMPT, previous);
	if (previous==TTime(0)) {
		sett.WriteSettingL(SETTING_LAST_CONNECTION_ATTEMPT, GetTime());
	}
}
/*sets a specific contact field to a value as determined by its type.
field at aPos in aFields is set to aText*/
void CPerformanceFunctionalityBase::SetFieldL(const TInt aPos, const TDesC& aText)
	{
	CContactItemField &field = (*iFields)[aPos];
	if( field.IsTemplateLabelField() )
		{
		return;
		}

	if( 0 == aText.Size() )
		{
		return;
		}

	switch(field.StorageType())
		{
		case KStorageTypeText:
			field.TextStorage()->SetTextL(aText);
		break;
		case KStorageTypeStore:
			{
			HBufC8 *buf = HBufC8::NewLC(aText.Size());
			TPtr8 tptr8 = buf->Des();
			tptr8.Copy(aText);
			field.StoreStorage()->SetThingL(*buf);
			CleanupStack::PopAndDestroy(buf);
			}
		break;
		case KStorageTypeContactItemId:
			{
			TInt id = 0;
			if( aText.Size() > 0 )
				{
				GetIntFromConfig( KOtherFields, KAgentId, id );
				}
			field.AgentStorage()->SetAgentId(id);
			}
		break;
		case KStorageTypeDateTime:
			{
			if( aText.Size() > 0 )
				{
				TPtrC time;
				GetStringFromConfig( KOtherFields, KFieldTime, time );
				field.DateTimeStorage()->SetTime( TTime(time) );
				}
			else
				{
				field.DateTimeStorage()->SetTime( TTime(0) );
				}
			}
		break;
		default:
			User::Panic(aText,EInvariantFalse);
		break;
		}
	}
EXPORT_C void CNetworkError::ConnectionRequestedL()
{
	MSettings& sett=GetContext()->Settings();
	TTime previous=TTime(0);
	sett.GetSettingL(SETTING_LAST_CONNECTION_REQUEST, previous);
	if (previous==TTime(0)) {
		sett.WriteSettingL(SETTING_LAST_CONNECTION_REQUEST, GetTime());
	}
	sett.WriteSettingL(SETTING_LATEST_CONNECTION_REQUEST, GetTime());
}
// --------------------------------------------------------------------------
// CUPnPPlaybackStateMachine::ConstructL
// --------------------------------------------------------------------------
//
void CUPnPPlaybackStateMachine::ConstructL()
    {
    __LOG( "CUPnPPlaybackStateMachine::ConstructL" );

    // Create timer for observing duration query time out.
    TInt64 iTime = 0;
    iPlayMark = TTime( iTime );
    iPauseMark = TTime( iTime );
    iPeriodizer = CUPnPMusicPeriodizer::NewL( *this, KPlaybackInfoTimeOut );
    iPeriodizerEnd = CUPnPMusicPeriodizer::NewL( *this, 
        KPlaybackInfoTimeOutEnd );
    }
void CTupleStoreImpl::CleanOldTuplesL()
{
	CALLSTACKITEM_N(_CL("CTupleStoreImpl"), _CL("CleanOldTuplesL"));

	SwitchIndexL(EIndexLeaseExpires);
	iTable.FirstL();
	iTable.GetL();

	TTupleName name; TBuf<KMaxTupleSubNameLength> subname;
	TTime expires;
	
	if (iTable.IsColNull(ELeaseExpires)) {
		expires=TTime(0);
	} else {
		expires=iTable.ColTime(ELeaseExpires);
	}
	TTime now=GetTime();
	TInt tupletype=-1;
	while (now > expires) {
		if ( iTable.IsColNull(ELeaseExpires) ) {
			UpdateL();
			iTable.SetColL( ELeaseExpires, Time::MaxTTime() );
			MDBStore::PutL();
		} else {
			tupletype=iTable.ColInt(ETupleType);
			if (tupletype == ETupleDataOrRequest) {
				name.iModule.iUid=iTable.ColInt(ENameModule);
				name.iId=iTable.ColInt(ENameId);
				subname=iTable.ColDes16(ENameSubName1);
			}
			MDBStore::DeleteL();
			if (tupletype == ETupleDataOrRequest) {
				iDeleteNotification.NotifyDeleted(name, subname);
			}
		}
		if (! iTable.NextL() ) return;
		iTable.GetL();
		if (iTable.IsColNull(ELeaseExpires)) {
			expires=TTime(0);
		} else {
			expires=iTable.ColTime(ELeaseExpires);
		}
	}
	if ( expires == TTime(0) || expires == Time::MaxTTime() ) return;

	TTimeIntervalSeconds s;
	TInt err=expires.SecondsFrom(now, s);
	if (err==KErrOverflow) return;

	iNextExpiry=expires;
	TInt wait=s.Int();
	iTimer->Wait(wait);
}
/**
 *	Second phase for initializing settings data
 */
void TCalendarManagerSettingItemListSettings::ConstructL()
	{
	// [[[ begin generated region: do not modify [Generated Initializers]
	SetSchedule_Date( TTime( TDateTime( 2000, EJanuary, 0, 0, 0, 0, 0 ) ) );
	SetSchedule_Time( TTime( TDateTime( 0, EJanuary, 0, 0, 0, 0, 0 ) ) );
		{
		HBufC* text = StringLoader::LoadLC( R_CALENDAR_MANAGER_SETTING_ITEM_LIST_SCHEDULE_CONTENT );
		SetSchedule_Content( text->Des() );
		CleanupStack::PopAndDestroy( text );
		}
	SetSchedule_Reminder( 0 );
	// ]]] end generated region [Generated Initializers]
	
	}
/*sets a specific contact field to a value as determined by its type.
field at aPos in aFields is set to aText*/
void CContactsRamTest::SetFieldL(const CContactItemField &aField, const TDesC& aText)
	{
	if( aField.IsTemplateLabelField() )
		{
		return;
		}
		
	if( 0 == aText.Size() )
		{
		return;
		}
	
	switch(aField.StorageType())
		{
		case KStorageTypeText:
			aField.TextStorage()->SetTextL(aText);
		break;
		case KStorageTypeStore:
			{
			HBufC8 *buf = HBufC8::NewLC(aText.Size());
			TPtr8 tptr8 = buf->Des();
			tptr8.Copy(aText);
			aField.StoreStorage()->SetThingL(*buf);
			CleanupStack::PopAndDestroy(buf);
			}
		break;
		case KStorageTypeContactItemId:
			{
			aField.AgentStorage()->SetAgentId( KAgentId );
			}
		break;
		case KStorageTypeDateTime:
			{
			if( aText.Size() > 0 ) 
				{
				aField.DateTimeStorage()->SetTime( TTime(KTime) );
				}
			else
				{
				aField.DateTimeStorage()->SetTime( TTime(0) );
				}
			}
		break;
		default:
			User::Panic(aText,EInvariantFalse);
		break;
		}
	}
Beispiel #17
0
// -----------------------------------------------------------------------------
// CBTGPSFix::ResetFix
// -----------------------------------------------------------------------------
void CBTGPSFix::ResetFix()
    {
    TRACESTRING("CBTGPSFix::ResetFix start...")
    TRealX nan;
    nan.SetNaN();
    
    ResetPosition();
    
    iSpeed=nan;
    iHeading=nan;
    
    iUsedSatellitesArray.Reset();
    iSatelliteTime = TTime(0);
    
    iHorizontalDoP = nan;
    iVerticalDoP = nan;
    iPositionDoP = nan;
    iSatellitesUsed = 0;
    
    //Clear the mask
    iReceivedMsgMask = 0;
    
    iGpsMode = EGpsModeSatellite;
    TRACESTRING("CBTGPSFix::ResetFix end")
    }
void CTcFileHandlerSession::DoCopyFileL( const RMessage2& aMessage ) const
    {
    TFileName sourcePath;
    ReadFileNameL( 0, aMessage, sourcePath );
    
    TFileName destinationPath;
    ReadFileNameL( 1, aMessage, destinationPath );
   	
    RFs fs;
	User::LeaveIfError( fs.Connect() );
	CleanupClosePushL( fs );
	
	CFileMan* fileMan = CFileMan::NewL(fs);
	CleanupStack::PushL(fileMan); 
	
	// Make sure path exists, ignore errors since path might exist already
	fs.MkDirAll( destinationPath );	
	
	// Make the destination file writeable, ignore errors since most probably
	// file doesn't exist yet
    fileMan->Attribs( destinationPath, 0, KEntryAttReadOnly, TTime( 0 ), 0 );
    
	User::LeaveIfError( fileMan->Copy( sourcePath, destinationPath ) );
    
	CleanupStack::PopAndDestroy( 2 ); // fileMan, fs
    }
// ---------------------------------------------------------------------------
// Record and check the time between connection attempts.
// ---------------------------------------------------------------------------
//
TBool CBTNotifConnectionTracker::RecordConnectionAttempts( TBool aAccepted )
    {
    BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
    TBool result = ETrue;
    TTime now( 0 );
    if( !aAccepted )
        {
        now.UniversalTime();
        if( iLastReject )
            {
            // Check the time between denied connections, that it does not go too fast.
            TTimeIntervalSeconds prev( 0 );
            if( !now.SecondsFrom( TTime( iLastReject ), prev ) )
                {
                if( prev <= KDENYTHRESHOLD )
                    {
                    // We are getting the requests too fast. Present the user with
                    // an option to turn BT off.
                    //iServer->SettingsTracker()->SetPower( EFalse );
                    result = EFalse;
                    }
                }
            }
        }
    // Record the current timestamp.
    // It is reset in case the user accepted the request.
    iLastReject = now.Int64();
    BOstraceFunctionExitExt( DUMMY_DEVLIST, this, result );
    return result;
    }
// Reset Mail Store(Mail2) so that old messages are deleted when new index file created..
void CMsvIndexContext::ResetAndCreateNewMailStoreL(TBool aDelete)
	{
	CFileMan* fileMan = CFileMan::NewL(iServer.FileSession());
	CleanupStack::PushL(fileMan);

	if(aDelete)
		{
		//Check if the mailfolder exists..
		if(BaflUtils::FileExists(iServer.FileSession(), iMessageFolder))
			{
			// Remove the readonly attribute..
			(void)fileMan->Attribs(iMessageFolder,0, KEntryAttReadOnly, TTime(0), CFileMan::ERecurse);
			// Remove old message store if exists..
			User::LeaveIfError(fileMan->RmDir(iMessageFolder));
			}
		}
		
	// Create the folder for the message store
	TInt err = iServer.FileSession().MkDirAll(iMessageFolder);
	if(err != KErrAlreadyExists)
		{
		User::LeaveIfError(err);
		}
	CleanupStack::PopAndDestroy(fileMan);
	}
Beispiel #21
0
Route_Node::Route_Node (void)
{
	Node (0);
	Dwell (0);
	TTime (0);
	Dir (0);
}
void CenrepSwiOOMTest::UpgradeInstallL(TBool aIsSetup)
	{
	if(aIsSetup)
		{
		// Install file
		InstallL(ETrue);
		InstallL(EFalse);

		RFs fs;
		User::LeaveIfError(fs.Connect());
		CleanupClosePushL(fs);
		CFileMan* fm = CFileMan::NewL(fs);
		CleanupStack::PushL(fm);

		// Get modification time
		TTime time;
		TBuf<50> fileName(KInstallFile);
		fs.Modified(fileName, time);

		// Copy upgrade file into install dir & Reset read-only bit
		User::LeaveIfError(fm->Copy(KInstallOnlyUpgradeFile, KInstallFile));
		User::LeaveIfError(fm->Attribs(KInstallFile,0,KEntryAttReadOnly,TTime(0)));
		// Modify timestamp to cause upgrade
		ModifyTimeStampL(fs,&fileName, time);

		CleanupStack::PopAndDestroy(2); // fs and fm
		}
	else
		{
		iSwiWatcher->HandleSWIEventL(ESASwisInstall | ESASwisStatusSuccess);
		}
	}
Beispiel #23
0
void CCntFilter::InternalizeL(RReadStream& aStream)
/** Internalises a CCntFilter object from a read stream. 
@param aStream Stream from which the object should be internalised. */
	{
	// CContactIdArray* iIds;
	if (iIds)
		{
		delete iIds;		
		iIds = NULL;
		}
		
	//TBool CheckIfExists=aStream.ReadInt32L();
	if (aStream.ReadInt32L())
		{
		iIds = CContactIdArray::NewL();		
		iIds->InternalizeL(aStream);
		}			
			
	// TTime iSinceDateTime;
	TInt64 tempInt64;
	aStream >> tempInt64;
	iSinceDateTime = TTime(tempInt64);	
	
	// TInclude	iInclude;
	iInclude = static_cast<TInclude>(aStream.ReadInt32L());

	// TInt32 iContactType;
	iContactType = aStream.ReadInt32L();
	
	// TAny* iReserved1;
	// TAny* iReserved2;	
	}
void CEmTubePlaylistEntry::ImportL( RFileReadStream& aStream )
	{
	TInt l = aStream.ReadInt32L();
	if( l )
		{
		iLocation = HBufC::NewL( l );
		TPtr pLocation( iLocation->Des() );
		aStream.ReadL( pLocation, l );
		}
	else
		{
		iLocation = KNullDesC().AllocL();
		}

	l = aStream.ReadInt32L();
	if( l )
		{
		iName = HBufC::NewL( l );
		TPtr pName( iName->Des() );
		aStream.ReadL( pName, l );
		}
	else
		{
		iName = KNullDesC().AllocL();
		}

	iPlayCount = aStream.ReadInt32L();
	iType = (TEmTubePlaylistEntryType)aStream.ReadInt32L();
	TReal t = aStream.ReadReal64L();
	iTime = TTime( Int64( t ) );
	}
Beispiel #25
0
LOCAL_C void DeleteMultipleContactsL(CContactDatabase* aDb)
    {
    CContactIdArray* idArray = aDb->ContactsChangedSinceL(TTime(0));
    CleanupStack::PushL(idArray);
    aDb->DeleteContactsL(*idArray);        
    CleanupStack::PopAndDestroy(idArray);
    }
void CenrepSwiOOMTest::UninstallROMUpgradeL(TBool aIsSetup)
	{
	if(aIsSetup)
		{
		// Install rev 2
		UpgradeROMRev2L(ETrue);
		UpgradeROMRev2L(EFalse);

		RFs fs;
		User::LeaveIfError(fs.Connect());
		CleanupClosePushL(fs);
		CFileMan* fm = CFileMan::NewL(fs);
		CleanupStack::PushL(fm);

		// Delete file from install dir
		User::LeaveIfError(fm->Attribs(KUpgradeFile,0,KEntryAttReadOnly,TTime(0)));
		TInt err=fs.Delete(KUpgradeFile);
		if((err!=KErrNone)&&(err!=KErrNotFound))
			User::Leave(err);

		CleanupStack::PopAndDestroy(2); // fs and fm
		}
	else
		{
		iSwiWatcher->HandleSWIEventL(ESASwisUninstall | ESASwisStatusSuccess);
		}
	}
void CCalOOMTest::TestFindInstancesL(const TDesC& aFindStartTime, const TDesC& aFindEndTime, CalCommon::TCalViewFilter aFilter)
	{
	test.Next(_L("OOM tests for FindInstanceL"));

	_LIT(KSearchText,				"summary");
	TCalTime findSt;
	findSt.SetTimeLocalL(TTime(aFindStartTime));
	TCalTime findEnd;
	findEnd.SetTimeLocalL(TTime(aFindEndTime));
	CalCommon::TCalTimeRange range(findSt, findEnd);
	
	RPointerArray<CCalInstance> instances;
	CCalInstanceView::TCalSearchParams params(KSearchText, CalCommon::EFoldedTextSearch);
	
	CCalInstanceView& view = iTestLib->SynCGetInstanceViewL();
	
	TInt tryCount = 1;
	TInt err = 0;
	
	// OOM LOOP
	for ( ;; )
		{
		
		RDebug::Printf("%d", tryCount);
		instances.ResetAndDestroy();
		__UHEAP_SETFAIL(RHeap::EFailNext, tryCount);
		
		__UHEAP_MARK;
		TRAP(err, view.FindInstanceL(instances, aFilter, range, params));
		if(	instances.Count()>0 )
		{
			instances.ResetAndDestroy();	//we are responsible for Cleanup of this array
		}
		__UHEAP_MARKEND;
	
		if ( err==KErrNone ) 
		{
			__UHEAP_RESET;
			RDebug::Printf("Memory allocation testing for FindInstance is done");
			break;
		}
		test(err == KErrNoMemory);
		__UHEAP_SETFAIL(RHeap::ENone, 0);		
		tryCount++;
		}
	// OOM LOOP
	}
TTime CBtStats::GetColTime(TInt aColumn)
{
	if (iTable.IsColNull(aColumn) ) {
		return TTime(0);
	} else {
		return iTable.ColTime(aColumn);
	}
}
Beispiel #29
0
double Performance_Data::Delay (int period)
{
	double ttime = TTime (period);
	double time0 = Time0 () / 10.0;

	if (time0 < 0.1) time0 = 0.1;

	return (ttime - time0);
}
Beispiel #30
0
double Performance_Data::Time_Ratio (int period)
{
	double ttime = TTime (period);
	double time0 = Time0 () / 10.0;

	if (time0 < 0.1) time0 = 0.1;

	return (ttime / time0);
}