Ejemplo n.º 1
0
void CTzBootPerformanceTest::TestBootupPerformanceL()
	{
	TTime startTime;
	TTime endTime;
	startTime.UniversalTime();

	RTz tz;
	User::LeaveIfError(tz.Connect());
	endTime.UniversalTime();
	tz.Close();
	
	TTimeIntervalMicroSeconds micros = endTime.MicroSecondsFrom(startTime);
	_LIT(KBootTime, "Time to connect time zone server = %d (ms) \n");
	test.Printf(KBootTime,micros);
	
#ifndef __WINS__
	
#ifdef GetPerformanceBaseline
	bootTimeBaseLine = micros.Int64();
	_LIT(KBootTimeBaseLine, "The baseline of boot-up time = %d (ms) \n");
	test.Printf(KBootTimeBaseLine,bootTimeBaseLine);
#else
	test((micros.Int64()-bootTimeBaseLine)/bootTimeBaseLine<0.1);
#endif
	
#endif
	}
Ejemplo n.º 2
0
void NotifyProvider::LogEventL(const CLogEvent &event)
{
    // store new call
    QString number=QString::fromRawData(reinterpret_cast<const QChar*>(event.Number().Ptr()),event.Number().Length());
    QString direction=QString::fromRawData(reinterpret_cast<const QChar*>(event.Direction().Ptr()),event.Direction().Length());
    QString description=QString::fromRawData(reinterpret_cast<const QChar*>(event.Description().Ptr()),event.Description().Length());
    if (description.contains("Voice call")&&direction.contains("Missed call"))
    {
        TTime times=event.Time();
        RTz tzsession;
        tzsession.Connect();
        tzsession.ConvertToLocalTime(times);
        tzsession.Close();
        TDateTime dts=times.DateTime();
        QDate d; QTime t;
        d.setYMD(dts.Year(),dts.Month()+1,dts.Day()+1);
        t.setHMS(dts.Hour(),dts.Minute(),dts.Second());
        QDateTime dt; dt.setDate(d); dt.setTime(t);
        dt=dt.toLocalTime();
        QString time=dt.toString("d.M.yy hh:mm");

        TNotifyInfo info;
        info.time=time;
        info.timeStamp=dt;
        info.sender=number;
        info.text=findContact(number);
        info.id=-1;
        info.type=EMissedCall;
        iNotifiers.insert(0,info);
        qDebug()<<"store call from"<<info.sender;
        prepareNotifier(EMissedCall);
    }
}
Ejemplo n.º 3
0
void CTzUserDataTest::DeleteCurrentUserTzL(RTz& aTz, TTest aWhatToTest)
	{
	test.Next(_L("Delete Current TZ rules - Server Response to Changes"));

	// Set system to default time zone
	ResetTimeZoneToLondonL();
	CTzId* defaulteTzid = aTz.GetTimeZoneIdL();
	test(KTzLondon()==defaulteTzid->TimeZoneNameID());
	delete defaulteTzid;
	
	// Set system to a newly created user time zone
	const TInt KStandardOffset = 60;
	const TInt KDSTOffset = 120;
	CreateUserTzAndSetCurrentTimeToL(aTz,KStandardOffset,KDSTOffset); 
	
	//Delete the user time zone
	DeleteCurrentTzL(aTz);
	
	if(aWhatToTest == EPersistence)
		{
		aTz.Close();	
		User::After(1000000);
		User::LeaveIfError(aTz.Connect());
		}
	CTzId* tzGot = aTz.GetTimeZoneIdL();
	test(KTzLondon()==tzGot->TimeZoneNameID());
	delete tzGot;
	}
Ejemplo n.º 4
0
bool_t GetIsDst(datetime_t UNUSED_PARAM(t))
{
#ifndef SYMBIAN90
    TLocale locale;
    return locale.QueryHomeHasDaylightSavingOn();
#else
    TBool IsDst=EFalse;
    RTz TzServer;
    if (TzServer.Connect()==KErrNone)
    {
        CTzConverter* Converter = CTzConverter::NewL(TzServer); 
        CTzId* TzId = CTzId::NewL(Converter->CurrentTzId());
        IsDst = TzServer.IsDaylightSavingOnL(*TzId);
        delete TzId;
        delete Converter;
        TzServer.Close();
    }
    return IsDst;
#endif
}
Ejemplo n.º 5
0
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;
}
Ejemplo n.º 6
0
datetime_t TimePackToRel(const datepack_t *tp, bool_t Local)
{
    TDateTime Date;
    TTime ot;
	if (!tp) return INVALID_DATETIME_T;
    Date.SetYear(tp->Year);
    Date.SetMonth((TMonth)(tp->Month-1));
    Date.SetDay(tp->Day-1);
    Date.SetHour(tp->Hour);
    Date.SetMinute(tp->Minute);
    Date.SetSecond(tp->Second);

    ot = TTime(Date);

    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->ConvertToUniversalTime(ot);
            delete Converter;
            TzServer.Close();
        }
#endif
    }

    return SymbianToDateTime(ot);
}