// -----------------------------------------------------------------------------
// CPIMAgnEventAdapter::ConvertAlarmToAgnL
// Converts alarm from PIM item to a native entry. The alarm is calculated
// from the start date of the event and if it is not present, the alarm field
// is ignored because there is no possibility to calculate it
// -----------------------------------------------------------------------------
//
void CPIMAgnEventAdapter::ConvertAlarmToAgnL(const MPIMEventItem& aItem,
        CCalEntry& aEntry)
{
    JELOG2(EPim);
    const MPIMItemData& itemData = aItem.ItemData();

    // Note that start time must be set before alarm can be calculated
    // Add start to the item so alarm can be properly converted. The
    // native entry does not accept alarm value if start is not present

    if (itemData.CountValues(EPIMEventStart) == 0)
    {
        User::Leave(KErrArgument);
    }
    else
    {
        ConvertDateFieldToAgnL(aItem, aEntry, EPIMEventStart);
    }

    __ASSERT_DEBUG(aEntry.StartTimeL().TimeUtcL() != Time::NullTTime(),
                   User::Panic(KPIMPanicCategory, EPIMPanicInvalidState));

    // Get alarm value from the Java item. There should be only one alarm
    // value supported by the PIM API because native entries do not support
    // multiple alarm values.
    const TPIMFieldData alarmData = itemData.ValueL(EPIMEventAlarm, 0);
    TInt value = alarmData.IntegerValue();

    // Count the alarm value from the start date of the event
    TTime entryStart = aEntry.StartTimeL().TimeLocalL();
    const TPIMFieldData startData = itemData.ValueL(EPIMEventStart, 0);
    TPIMDate startTime = startData.DateValue();
    ConvertTimeL(startTime, EPIMDateLocal);
    TTimeIntervalSeconds temp(0);
    User::LeaveIfError(entryStart.SecondsFrom(startTime, temp));

    // Add difference between PIM API start and start which has been
    // converted to the item (in case if the date has been changed, it is
    // reflected here)
    value += temp.Int();

    // Check that if the alarm has passed to the following day. In this case,
    // the alarm is transferred back to 12 o'clock of the current start date
    TTime alarmTime(entryStart - TTimeIntervalSeconds(value));
    // Temporary date. This date is used when calculating if the alarm
    // value has passed to the following date.
    TTime startOfNextDay(StartOfDay(startTime + TTimeIntervalDays(1)));
    if (alarmTime >= startOfNextDay)
    {
        alarmTime = StartOfDay(entryStart);
        alarmTime += TTimeIntervalSeconds(KPIMDefaultAlarmInterval);
        User::LeaveIfError(entryStart.SecondsFrom(alarmTime, temp));
        value = temp.Int();
    }
    // Convert the alarm value to the native entry
    SetAlarmToEntryL(aEntry, value);
}
Exemplo n.º 2
0
/*
-------------------------------------------------------------------------
-------------------------------------------------------------------------
*/
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;
}
Exemplo n.º 3
0
LOCAL_C void DeleteGroupMembersCheckPersist()
	{
	test.Next(_L("Delete Group Members Check Persist"));
//
	TTime before;
	before.UniversalTime();
	for(TInt ii=1;ii<KLargeSizeRecords+1;ii++)
		{
		CntTest->Db()->DeleteContactL(ii);
		if (ii%100==0)
			test.Printf(_L("."));	// Just to show some life
		}
	TTime after;
	after.UniversalTime();
	TTimeIntervalSeconds secondsTaken;
	after.SecondsFrom(before,secondsTaken);
	test.Printf(_L(" TIME: %d  Secs"),secondsTaken.Int());
	test.Printf(_L("\n"));	
	//test.Getch();
//
	CContactIdArray* groups = CntTest->Db()->GetGroupIdListL();
	CleanupStack::PushL(groups);
	CContactItem* group = CntTest->Db()->ReadContactL((*groups)[0]);
	CContactIdArray* memberArray = STATIC_CAST(CContactGroup*,group)->ItemsContainedLC();
	test(memberArray->Count()==0);
	delete group;
	CleanupStack::PopAndDestroy(2); // groups memberArray
	}
Exemplo n.º 4
0
LOCAL_C void DeleteManyGroups()
	{
//
	test.Next(_L("Delete MANY Groups"));
	TTime before;
	before.UniversalTime();
	for(TInt ii=6;ii<KLargeSizeRecords+6;ii++)
		{
		CntTest->Db()->DeleteContactL(ii);
		if (ii%100==0)
				test.Printf(_L("."));	// Just to show some life
		}
	TTime after;
	after.UniversalTime();
	TTimeIntervalSeconds secondsTaken;
	after.SecondsFrom(before,secondsTaken);
	test.Printf(_L(" TIME: %d  Secs"),secondsTaken.Int());
	test.Printf(_L("\n"));	
	//test.Getch();

//
	test.Next(_L("Test Card Membership Update"));
	test(CntTest->Db()->CountL()==5); // 5 contacts + own card
	for(TInt jj=1;jj<6;jj++)
	// add cards to all groups
		{
		CContactItem* contact = CntTest->Db()->ReadContactLC(jj);
		CContactIdArray* groups = STATIC_CAST(CContactCard*, contact)->GroupsJoinedLC();
		test(groups->Count()==0);
		CleanupStack::PopAndDestroy(2); // contact groups
		}
	CntTest->Db()->CompactL();
	}
Exemplo n.º 5
0
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;
    }
}
Exemplo n.º 6
0
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);
    }
Exemplo n.º 7
0
TInt CEventLogger::UpdateLogEventParam(CLogEvent& aLogEvent, TInt aRConnectionStatusId, const TUid& aDataEventType, const TInt64& aBytesSent, const TInt64& aBytesReceived)
{

    TTime time;
    TInt ret =KErrNone;
    time.UniversalTime();
    TTimeIntervalSeconds interval(0);
    if (time.SecondsFrom(iCurrentLogEvent->Time(),interval) != KErrNone)
    {
        interval = 0;	// no duration available ->error
    }
    if (KConnectionStatusIdNotAvailable != aRConnectionStatusId)
    {
        //status needs to be updated
        TBuf<KLogMaxStatusLength > logStatusBuf;
        iLogWrap->Log().GetString(logStatusBuf, aRConnectionStatusId); // Ignore error - string blank on error which is ok
        aLogEvent.SetStatus(logStatusBuf);
    }
    if ( aDataEventType != TUid::Null())
    {
        aLogEvent.SetEventType(aDataEventType);
    }
    aLogEvent.SetDuration(interval.Int());		//0 or not
    //check if data metrics need to be updated
    TInt64 byteInfoNotAvailable(KBytesInfoNotAvailable);
    if ((aBytesReceived != byteInfoNotAvailable) && (aBytesSent != byteInfoNotAvailable))
    {
        TBuf8<KDatabufferSize> dataBuffer;
        dataBuffer.Num(aBytesSent);
        dataBuffer.Append(TChar(','));
        dataBuffer.AppendNum(aBytesReceived);
        TRAP(ret, aLogEvent.SetDataL(dataBuffer));
    }
    return ret;
}
Exemplo n.º 8
0
// Return true if first argument is iLeewaySeconds or more before the second
// argument.  Hence it is conservative, and should be always used "positively"
// to check for error conditions.
TBool COCSPValidator::TimeIsBeforeL(const TTime& aBefore, const TTime& aAfter)
	{
	TTimeIntervalSeconds difference;
	const TTimeIntervalSeconds leeway(iLeewaySeconds);	

	User::LeaveIfError(aAfter.SecondsFrom(aBefore, difference));
	return (difference > leeway);
	}
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;
}
Exemplo n.º 10
0
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();
}
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);
}
Exemplo n.º 12
0
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);
		}
	}
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);
}
Exemplo n.º 14
0
LOCAL_C void RestoreDateAndTime()
	{
	if (StartTimeSet)
		{
		TTime aCurrentTime;
		aCurrentTime.UniversalTime();
		TTimeIntervalSeconds aDuration;
		if (!aCurrentTime.SecondsFrom(StartTime,aDuration))
			StartTime+=aDuration;
		User::SetHomeTime(StartTime);
		StartTimeSet=EFalse;
		}
	}
Exemplo n.º 15
0
// ------------------------------------------------------------------------
// 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" ) );
}
Exemplo n.º 16
0
/**
   @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);
	}
Exemplo n.º 17
0
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;
}
Exemplo n.º 18
0
void CSuspendTest::TimeSinceStart() const
	{
	TTimeIntervalSeconds timeTaken;
	TTime time;
	time.HomeTime();
	TInt r = time.SecondsFrom(iStartTime, timeTaken);
	test(r == KErrNone);
	TInt totalTime = timeTaken.Int();

	TInt seconds = totalTime % 60;
	TInt minutes = (totalTime / 60) % 60;
	TInt hours   = totalTime / 3600;

	test.Printf( _L("Time since test started = %d:%d:%d\n"), hours, minutes, seconds );
	}
Exemplo n.º 19
0
LOCAL_C void CheckLargePopulatedGroup()
	{
	test.Next(_L("Create MANY Contacts"));
	CntTest->CloseDatabase();
	CntTest->DeleteDatabaseL();
	CntTest->CreateDatabaseL();
	TRAP_IGNORE(PopulateDatabaseL(KLargeSizeRecords,ETrue));
	CContactItem* newGroup = CntTest->Db()->CreateContactGroupL(_L("Large Group"));
	CleanupStack::PushL(newGroup);
	TContactItemId groupId = newGroup->Id();
	test.Next(_L("Add MANY Contacts to a Group"));
	TTime before;
	before.UniversalTime();
	for(TInt ii=1;ii<KLargeSizeRecords+1;ii++)
		{
		CntTest->Db()->AddContactToGroupL(ii, groupId); //*tempContact,*newGroup);
		if (ii%100==0)
			test.Printf(_L("."));	// Just to show some life
		}
	test(TestGroupStateL(CntTest->Db(),1,KLargeSizeRecords));
	TTime after;
	after.UniversalTime();
	TTimeIntervalSeconds secondsTaken;
	after.SecondsFrom(before,secondsTaken);
	test.Printf(_L(" TIME: %d  Secs"),secondsTaken.Int());
	test.Printf(_L("\n"));	
	//test.Getch();
	CntTest->CloseDatabase();
	CntTest->OpenDatabaseL();
//
	CContactItem* familyGroup = CntTest->Db()->ReadContactL(groupId);
	CContactIdArray* memberArray = STATIC_CAST(CContactGroup*,familyGroup)->ItemsContainedLC();
	test(memberArray->Count()==KLargeSizeRecords);
	delete familyGroup;
//
	CContactItem* familyMember = CntTest->Db()->ReadContactL(2);
	CContactIdArray* groups = STATIC_CAST(CContactCard*, familyMember)->GroupsJoinedLC();
	test(groups->Count()==1);
	TContactItemId memberShip = (*groups)[0];
	test(memberShip==groupId);
	delete familyMember;
	CleanupStack::PopAndDestroy(3); // newGroup groups memberArray
	}
Exemplo n.º 20
0
void MainWindow::GenerateKey(TDes8& aKey, TInt aLen)
        {
        aKey.Zero();

        TTime currentTime;
        currentTime.HomeTime();

        // ??000Ä꿪ʼ¼Æ??
        TInt startYear = 2000;

        // µ±Ç°Äê·Ý
        TInt currentYear = currentTime.DateTime().Year();
        TTime time(TDateTime(currentYear, EJanuary, 0, 0, 0, 0, 0));

        TTimeIntervalSeconds s;
        currentTime.SecondsFrom(time, s);

        // µÃµ½ÃëÊý
        TInt i = s.Int();

        aKey.AppendFormat(_L8("%X"), i);
        aKey.AppendFormat(_L8("%X"), currentYear - startYear);

        TInt len = aKey.Length();
        if (len > aLen)
                {
                aKey.Mid(0, aLen);
                }
        else
                {
                for (TInt i = 0; i < aLen - len; i++)
                        {
                        TTime theTime;
                        theTime.UniversalTime();
                        TInt64 randSeed(theTime.Int64());
                        TInt number(Math::Rand(randSeed) + i);

                        number = number % 10 + 48;
                        aKey.Append(number);
                        }
                }
        }
Exemplo n.º 21
0
GLDEF_C TInt E32Main()
//
// Main entry point
//
    {
	TInt r;

    CTrapCleanup* cleanup;
    cleanup=CTrapCleanup::New();
    __UHEAP_MARK;

    test.Title();
    test.Start(_L("Starting tests..."));

    r=TheFs.Connect();
    test_KErrNone(r);

    // TheFs.SetAllocFailure(gAllocFailOn);
    TTime timerC;
    timerC.HomeTime();

	// Do the tests
    TRAP(r,CallTestsL());

    // reset the debug register
    TheFs.SetDebugRegister(0);

    TTime endTimeC;
    endTimeC.HomeTime();
    TTimeIntervalSeconds timeTakenC;
    r=endTimeC.SecondsFrom(timerC,timeTakenC);
    test_KErrNone(r);
    test.Printf(_L("Time taken for test = %d seconds\n"),timeTakenC.Int());
    // TheFs.SetAllocFailure(gAllocFailOff);
    TheFs.Close();
    test.End();
    test.Close();
    __UHEAP_MARKEND;
    delete cleanup;
    return(KErrNone);
    }
Exemplo n.º 22
0
/** 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;
	}
Exemplo n.º 23
0
//Allow the calling process to retrieve the value used by a clock which 
//is specified by clock_id
EXPORT_C int clock_gettime (clockid_t clock_id, struct timespec *tp)
{
	int retval = -1;
	TTime t;
	TTimeIntervalSeconds iSeconds;
	TInt err;
	//We expect the user of the library to give us a valid pointer	
	if(tp == NULL)
	{
		errno = EFAULT;
		return retval;
	}

	switch(clock_id)
	{
		case CLOCK_REALTIME:
			//We use TTime::UniversalTime() call to get the Universal time
			t.UniversalTime();
			err = t.SecondsFrom(UNIX_BASE, iSeconds);
			t-=iSeconds;//extracting seconds info into iSeconds
			if (!err)
			{
				tp->tv_sec = iSeconds.Int();
				tp->tv_nsec = t.Int64();
				retval = 0;
			}
			break;
		
		default:
			//For all other clocks that cannot be supported or invalid clockids,
			//we set errno to invalid
			retval = -1;
			errno = EINVAL;
			break;
	}
	return retval;
}
TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText,
                                                   TBIOMessageType aMessageType)
{
		// Ensure that we have a valid service ID to work with:
		TMsvId iBioServiceId;

		iBioServiceId = SetBIOServiceIdL();

		HBufC* localBuffer = aText.AllocL();
		CleanupStack::PushL(localBuffer);

		TPtr messDes = localBuffer->Des();

		if (aMessageType != EBiovCardMessage && aMessageType
            != EBiovCalenderMessage)
			{
				// convert \r\n to \n since this is what is expected from SMS when not vCard data
				for (TInt i = 0; i < messDes.Length(); i++)
					{
						if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1
								&& messDes[i + 1] == (TText) '\n')
							messDes.Delete(i, 1);
					}
			}

		//  Create and fill a CRichText object for the jobbie:
		CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
		CleanupStack::PushL(paraFormatLayer);
		CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
		CleanupStack::PushL(charFormatLayer);
		CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
		CleanupStack::PushL(richText);

		TInt pos = richText->DocumentLength();
		richText->InsertL(pos, messDes);

		TMsvEntry newBioEntry;
		newBioEntry.SetNew(ETrue);
		newBioEntry.SetComplete(EFalse);
		newBioEntry.SetUnread(ETrue);
		newBioEntry.SetVisible(ETrue);
		newBioEntry.SetReadOnly(EFalse);
		newBioEntry.SetFailed(EFalse);
		newBioEntry.SetOperation(EFalse);
		newBioEntry.SetMultipleRecipients(EFalse);
		newBioEntry.SetAttachment(EFalse);
		newBioEntry.iMtm = KUidBIOMessageTypeMtm;
		newBioEntry.iType = KUidMsvMessageEntry;
		newBioEntry.iServiceId = iBioServiceId;
		TTime now;
		now.UniversalTime();
		newBioEntry.iDate = now;

		TTime unixEpoch(KUnixEpoch);
		TTimeIntervalSeconds seconds;
		TTime timeStamp = newBioEntry.iDate;
		timeStamp.SecondsFrom(unixEpoch, seconds);
		retTimeStamp.setTime_t(seconds.Int());

		newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength()));
		TBufC<KTelephoneNumberMaxLength> telNumber;

		QString recepient(TEST_MSG_FROM1);
		tempNumber = XQConversions::qStringToS60Desc(recepient);

		telNumber = tempNumber->Des();
		newBioEntry.iDetails.Set(telNumber);

		SetForMtmTypeL(newBioEntry, aMessageType);

		newBioEntry.iSize = richText->DocumentLength();// msgSize;
		CreateBioEntryClientSideL(newBioEntry, *richText);

		CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer
		return newBioEntry.Id();
}
//---------------------------------------------------------------
// TestUniDataModelPlugin::createMMS
//---------------------------------------------------------------
void TestUniDataModelMMSPlugin::createMMS(TMsvId pId, TBool subjectField)
    {
    TMsvEntry indexEntry;
    indexEntry.iType = KUidMsvMessageEntry;
    indexEntry.iMtm = KUidMsgTypeMultimedia;
    indexEntry.iServiceId = iServiceId;
    indexEntry.iDate.HomeTime();
    
    // Convert TTime to QDateTime , this will be used for comparing the time of mesage 
    // when fetched from datamodel
    TTime unixEpoch(KUnixEpoch);
    TTimeIntervalSeconds seconds;
    TTime timeStamp = indexEntry.iDate;
    timeStamp.SecondsFrom(unixEpoch, seconds);
    retTimeStamp.setTime_t(seconds.Int());

    TMsvId parentId = pId;
    CMsvEntry* entry = CMsvEntry::NewL(*iMSession,parentId,TMsvSelectionOrdering());
    CleanupStack::PushL(entry);

    entry->SetEntryL(parentId);
    entry->CreateL(indexEntry);
    entry->SetEntryL(indexEntry.Id());
    iMmsClientMtm->SwitchCurrentEntryL(entry->EntryId());

    CMsvStore* store = iMmsClientMtm->Entry().EditStoreL();
    CleanupStack::PushL(store);
      
    //MMS Message ID Saved
    iMessageId = indexEntry.Id();
    
    //Adding Subject
    if(subjectField)
        {
        QString subject(TEST_MSG_SUBJECT);
        HBufC* subj = XQConversions::qStringToS60Desc(subject);
        iMmsClientMtm->SetSubjectL(*subj);
        }

    //Adding Sender
    QString sender(TEST_MSG_FROM1);
    HBufC* addr = XQConversions::qStringToS60Desc(sender);
    
    if (addr)
        {
        CleanupStack::PushL(addr);
        TBuf<32> name;
        name.Copy(addr->Left(32));
        indexEntry.iDetails.Set(name);
        
        iMmsClientMtm->SetSenderL(*addr);
        
        CleanupStack::PopAndDestroy(addr);
        }
    
    //Adding Recipient
    QString recipient(TEST_MSG_RECIEPIENT1);
    HBufC* addr2 = XQConversions::qStringToS60Desc(recipient);
    if (addr2)
        {
        CleanupStack::PushL(addr2);
        iMmsClientMtm->AddAddresseeL(EMsvRecipientTo,*addr2);
        CleanupStack::PopAndDestroy(addr2);
        }
    
    //Adding cCRecipient
    QString recipient2(TEST_MSG_RECIEPIENT2);
    HBufC* addr3 = XQConversions::qStringToS60Desc(recipient2);
    if (addr3)
        {
        CleanupStack::PushL(addr3);
        iMmsClientMtm->AddAddresseeL(EMsvRecipientCc,*addr3);
        CleanupStack::PopAndDestroy(addr3);
        }
      
    //Adding bCCRecipient
    QString recipient3(TEST_MSG_RECIEPIENT3);
	HBufC* addr4 = XQConversions::qStringToS60Desc(recipient3);
	if (addr4)
		{
		CleanupStack::PushL(addr4);
		iMmsClientMtm->AddAddresseeL(EMsvRecipientBcc,*addr4);
		CleanupStack::PopAndDestroy(addr4);
		}
	
    //Create Text Attachment
    TMsvAttachmentId attaId = 0;
    TFileName attachmentFile( _L("story.txt") );
    TBufC<12> story = _L( "Hello world!" );
    
    iMmsClientMtm->CreateTextAttachmentL(*store, attaId, story, attachmentFile, ETrue );
    qDebug() << "Text Attachment id" << attaId;
    
    //Image Attachment added to the message entry
    RFile attaFile;
	// Set filename of attachment
	TFileName name( KPictureFileName );
   
	CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
	CleanupStack::PushL( mimeHeaders );
   
	// Set values to mime headers
	mimeHeaders->SetContentTypeL( _L8( "image") );
	mimeHeaders->SetContentSubTypeL( _L8( "jpeg" ) );
   
	_LIT8(KMimeType, "image/jpeg");
	TBufC8<10> mimeType(KMimeType);
	// CreateAttachment2L will set the content type to attachment Info
   
	// Open the attachment file for reading
	attaFile.Open( iFs, name, EFileShareReadersOnly | EFileRead );
	CleanupClosePushL(attaFile);
   
	CMsvAttachment* attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
	// attaInfo ownerhip will be transferred to Attachment Manager.
	// It must not be pushed onto the cleanupStack before calling 
	// CreateAttachment2L.
   
	iMmsClientMtm->CreateAttachment2L(*store, attaFile,mimeType,*mimeHeaders,attaInfo,attaId);
	qDebug() << "Image Attachment id" << attaId;
	
	// Now Attachment Manager owns the attaInfo
	CleanupStack::Pop(); // attaFile.Close()
	CleanupStack::PopAndDestroy(); // mimeHeaders
        
    store->CommitL();
    
    CleanupStack::PopAndDestroy(store); // store
    
    iMmsClientMtm->SaveMessageL();
    
    //Saving the message size for future checking
    msgSize = iMmsClientMtm->MessageSize();
    
    CleanupStack::Pop(entry); // entry
    }
Exemplo n.º 26
0
TBool COCSPValidator::ValidateTimeL()
	{
	const TTime validationTime = ValidationTime();
	const TTime producedAt = iResponse->ProducedAt();
	
	// For each certificate request, do the following:
	// 1. Check thisUpdate
	// 2. Check producedAt 
	TInt numCerts = iRequest->CertCount();
	for (TInt requestIndex = 0; requestIndex < numCerts; ++requestIndex)
		{
		const COCSPResponseCertInfo& responseCertInfo = iResponse->CertInfo(iRequestIndex[requestIndex]);
		const TTime thisUpdate = responseCertInfo.ThisUpdate();
		const TTime* nextUpdate = responseCertInfo.NextUpdate();

		// Check validity interval of response includes validation time
		// and producedAt time (if different).  Give iLeewaySeconds second's lee-way.

		// 4.2.2.1 "Responses whose thisUpdate time is later than the local
		// system time SHOULD be considered unreliable"
		if (TimeIsBeforeL(validationTime, thisUpdate))
			{
			iOutcome->iStatus = OCSP::EThisUpdateTooLate;
			return EFalse;
			}

		// Check producedAt later than thisUpdate.  This is not mandated by the spec.
		if (TimeIsBeforeL(producedAt, thisUpdate))
			{
			iOutcome->iStatus = OCSP::EThisUpdateTooLate;
			return EFalse;
			}
		
		if (nextUpdate)
			{
			// 4.2.2.1 "Responses whose nextUpdate value is earlier than the
			// local system time value SHOULD be considered unreliable"
			// 3.2.6 "OCSP clients shall confirm that ... nextUpdate is greater
			// than the current time."
			if (TimeIsBeforeL(*nextUpdate, validationTime))
				{
				iOutcome->iStatus = OCSP::ENextUpdateTooEarly;
				return EFalse;
				}

			// Check nextUpdate later than producedAt.  This is not mandated by the spec.
			if (TimeIsBeforeL(*nextUpdate, producedAt))
				{
				iOutcome->iStatus = OCSP::ENextUpdateTooEarly;
				return EFalse;
				}
			}
		
		// 3.2.5 "OCSP clients SHALL confirm that ... thisUpdate is sufficiently
		// recent"
		if (iMaxStatusAge)
			{
			TTimeIntervalSeconds difference;

			User::LeaveIfError(validationTime.SecondsFrom(thisUpdate, difference));
			const TTimeIntervalSeconds maxUpdateAge(iMaxStatusAge + iLeewaySeconds);	
			if (difference > maxUpdateAge)
				{
				iOutcome->iStatus = OCSP::EThisUpdateTooEarly;
				return EFalse;
				}	
			}

		// Check certificate validity period against validation time.
		// 
		// Strictly speaking, the OCSP protcol is about checking revocation
		// rather then checking whether a certificate has just expired.
		// However, it's difficult to check this on a device when you don't have
		// an accurate value for the current time.  We do the check here for
		// completeness, and trust the time given to us by the ocsp server.  If
		// we are using a nonce, as we will be most of the time, we can
		// guarantee that the producedAt time is current.

		const CX509Certificate& cert = iRequest->CertInfo(requestIndex).Subject();
		const CValidityPeriod& validityPeriod = cert.ValidityPeriod();

		if (!validityPeriod.Valid(validationTime))
			{
			iOutcome->iStatus = OCSP::ECertificateNotValidAtValidationTime;
			return EFalse;
			}

		} // Continue with next cert

	// If we've got this far, we're fine
	return ETrue;
	}
Exemplo n.º 27
0
// -----------------------------------------------------------------------------
// CDRMConstraint::Expired
// -----------------------------------------------------------------------------
//
EXPORT_C TBool CDRMConstraint::Expired( const TTime& aTime ) const
    {
    // Full Rights do not expire
    if ( iActiveConstraints == EConstraintNone )
        {
        return EFalse;
        }

    // First check counters, accumulated time and timed counters
    // if any of these is expired the whole thing is expired regardless of the
    // actual time based constrants or future rights

    // Counters
    if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 )
        {
        return ETrue;
        }

    // Accumulated time
    if ( ( iActiveConstraints & EConstraintAccumulated ) && iAccumulatedTime.Int() == 0 )
        {
        return ETrue;
        }

     // Timed Counters
    if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 )
        {
        return ETrue;
        }


    // Dont check time based rights
    if ( aTime != Time::NullTTime() )
        {

        // Check for activated intervals
        if ( ( iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() )
            {
            TTimeIntervalSeconds current;

            aTime.SecondsFrom( iIntervalStart, current );

            if ( current >= iInterval )
                {
                return ETrue;
                }
            }

        // Check for end time
        if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime )
            {
            return ETrue;
            }

        // Check for start time, future rights
        if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime )
            {
            return EFalse;
            }
        }

    return EFalse;
    }
Exemplo n.º 28
0
// -----------------------------------------------------------------------------
// CDRMConstraint::Valid
// -----------------------------------------------------------------------------
//
EXPORT_C TBool CDRMConstraint::Valid( const TTime& aTime,
                                      const RPointerArray<HBufC8>& aIndividual,
                                      TUint32& aRejection ) const
    {
    TBool drmTime = EFalse;
    // Null the rejection requirement:
    aRejection = EConstraintNone;

    // Full Rights are always valid
    if ( iActiveConstraints == EConstraintNone )
        {
        return ETrue;
        }

    // First check counters, accumulated time and timed counters
    // if any of these are invalid the whole thing is invalid regardless of the
    // actual time based constraints

    // Counters
    if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 )
        {
        aRejection |= EConstraintCounter;
        }

    // Accumulated time
    if ( ( iActiveConstraints & EConstraintAccumulated ) && iAccumulatedTime.Int() == 0 )
        {
        aRejection |= EConstraintAccumulated;
        }

     // Timed Counters
    if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 )
        {
        aRejection |= EConstraintTimedCounter;
        }

    // Dont check time based rights
    if ( aTime != Time::NullTTime() )
        {
        drmTime = ETrue;
        // Check for activated intervals
        if ( (iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() )
            {
            TTimeIntervalSeconds current;

            aTime.SecondsFrom( iIntervalStart, current );

            if ( ( current >= iInterval ) || ( aTime < iIntervalStart ) )
                {
                aRejection |= EConstraintInterval;
                }
            }

        // Check for end time
        if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime )
            {
            aRejection |= EConstraintEndTime;
            }

        if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime )
            {
            aRejection |= EConstraintStartTime;
            }
        }
    else
        {
        drmTime = EFalse;

        // Check for activated intervals
        if ( (iActiveConstraints & EConstraintInterval) )
            {
            aRejection |= EConstraintInterval;
            }

        // Check for end time
        if ( ( iActiveConstraints & EConstraintEndTime ) )
            {
            aRejection |= EConstraintEndTime;
            }

        if( ( iActiveConstraints & EConstraintStartTime ) )
            {
            aRejection |= EConstraintStartTime;
            }
        }

    // IMSI Checking:
    if( iActiveConstraints & EConstraintIndividual )
        {
        if ( !aIndividual.Count() && !iIndividual.Count() )
            {
            aRejection |= EConstraintIndividual;
            }
        else if( !IsIndividualConstraintValid( iIndividual, aIndividual ) )
            {
            aRejection |= EConstraintIndividual;
            }
        }

    if( aRejection )
        {
        // drmTime is null, so some constraints may have been discarded because of that
        if( !drmTime )
            {
            aRejection |= EConstraintNullDrmTime;
            }
        return EFalse;
        }

    return ETrue;
    };
Exemplo n.º 29
0
LOCAL_C void PopulateDatabaseL(TInt aNumberToPopulate, TBool aPhoneNumbers)
//
// Create and populate the database
//
	{
	TTime before;
	before.UniversalTime();
	CContactItem* templ = CntTest->Db()->ReadContactL(0);
	CleanupStack::PushL(templ);
	for (TInt ii=0;ii<aNumberToPopulate;ii++)
		{
		CContactItem* item=CContactCard::NewLC(templ);
		TBuf<16> name;
		name.Format(KTestName,ii);
   		SetNameL(*item,KUidContactFieldGivenName,name);
		if (aPhoneNumbers)
			{
			TBuf<20> number;
			switch(ii%3)
				{
				case 0:
					number.Format(_L("0171-%03d %04d"),(ii*9)%1000,((ii+11)*23)%10000);
					break;
				case 1:
					number.Format(_L("%04d:%04d:%04d:%04d"),(ii*123)%10000,(ii*666)%10000,(ii*234)%10000);
					break;
				case 2:
					number.Format(_L("+00%d-%03d %04d"),(ii*123)%100,(ii*13)%1000,((ii+13)*17)%10000);
					break;
				}
   			SetNameL(*item,KUidContactFieldPhoneNumber,number);
			if (!(ii%2))
				{
				number.Format(_L("0181-%03d %04d"),(ii*8)%1000,((ii+11)*22)%10000);
	   			SetNameL(*item,KUidContactFieldPhoneNumber,number);
				number.Format(_L("01734-%06d"),(ii*123456)%1000000);
	   			SetNameL(*item,KUidContactFieldPhoneNumber,number);
				}
			}
		TBuf<32> address;
		address.Format(KTestAddress,ii);
		SetNameL(*item,KUidContactFieldAddress,address);
//
		TBuf<32> familyName;
		familyName.Format(KTestFamilyName,ii);
		SetNameL(*item,KUidContactFieldFamilyName,familyName);
//
		TBuf<32> email;
		email.Format(KTestEmail,ii);
		SetNameL(*item,KUidContactFieldEMail,email);
//
		TBuf<32> country;
		country.Format(KTestCountry,ii);
		SetNameL(*item,KUidContactFieldCountry,country);
//	
		TBuf<32> company;
		company.Format(KTestCompany,ii);
		SetNameL(*item,KUidContactFieldCompanyName,company);
//	
		CntTest->Db()->AddNewContactL(*item); //templ
		CleanupStack::PopAndDestroy(); // item
//	
		if (ii%100==0)
			{
			test.Printf(_L("."));	// Just to show some life
			CntTest->Db()->CompactL();
			}

		}
	CleanupStack::PopAndDestroy();
	CntTest->Db()->SetDateFormatTextL(_L("%E%D%X%N%Y %1 %2 %3"));
	CntTest->Db()->CompactL();
	TTime after;
	after.UniversalTime();
	TTimeIntervalSeconds secondsTaken;
	after.SecondsFrom(before,secondsTaken);
	test.Printf(_L(" TIME: %d  Secs"),secondsTaken.Int());
	test.Printf(_L("\n"));	
	//test.Getch();
	}
Exemplo n.º 30
0
LOCAL_C void CreateManyGroups()
	{
	test.Next(_L("Populate Database"));
	CntTest->CloseDatabase();
	CntTest->DeleteDatabaseL();
	CntTest->CreateDatabaseL();
	// add 5 new contacts
	TRAP_IGNORE(PopulateDatabaseL(5,ETrue));
//
	test.Next(_L("Create MANY Groups"));
	TTime before;
	before.UniversalTime();
	for(TInt ii=0;ii<KLargeSizeRecords;ii++)
		{
		TBuf<32> label;
		label.Format(KGroupLabel,ii);
		CContactItem* newGroup = CntTest->Db()->CreateContactGroupL(label);
		if (ii%100==0)
				test.Printf(_L("."));	// Just to show some life
		delete newGroup;
		}
	TTime after;
	after.UniversalTime();
	TTimeIntervalSeconds secondsTaken;
	after.SecondsFrom(before,secondsTaken);
	test.Printf(_L(" TIME: %d  Secs"),secondsTaken.Int());
	test.Printf(_L("\n"));	
	//test.Getch();
	test(CntTest->Db()->GroupCount()==KLargeSizeRecords);
//
	test.Next(_L("Add 5 Contacts to MANY Groups"));
	before.UniversalTime();
	for(TInt jj=1;jj<6;jj++)
	// add cards to all groups
		{
		CContactItem* contact = CntTest->Db()->ReadContactL(jj);
		CleanupStack::PushL(contact);
		for(TInt gg=6;gg<KLargeSizeRecords+6;gg++)	// assume knowledge of group ids..
			{
			CntTest->Db()->AddContactToGroupL(jj,gg);	//*contact,*group);
			if (gg%100==0)
				test.Printf(_L("."));	// Just to show some life
			}
		CleanupStack::PopAndDestroy(); // contact
		}
	after.UniversalTime();
	after.SecondsFrom(before,secondsTaken);
	test.Printf(_L(" TIME: %d  Secs"),secondsTaken.Int());
	test.Printf(_L("\n"));	
	test(TestGroupStateL(CntTest->Db(),KLargeSizeRecords,5*KLargeSizeRecords));
	//test.Getch();

//
	test.Next(_L("Check Contacts Group membership"));
	before.UniversalTime();
	for(TInt gg=1;gg<6;gg++)
	//	check cards membership
		{
		CContactItem* contact = CntTest->Db()->ReadContactLC(gg);
		CContactIdArray* groups = STATIC_CAST(CContactCard*, contact)->GroupsJoinedLC();
		test(groups->Count()==KLargeSizeRecords);
		CleanupStack::PopAndDestroy(2); // contact groups
		}
	after.UniversalTime();
	after.SecondsFrom(before,secondsTaken);
	test.Printf(_L(" TIME: %d  Secs"),secondsTaken.Int());
	test.Printf(_L("\n"));	
	//test.Getch();

	}