// // Gets the encoded rules for the current standard time alignment, between aStartDateTime and aEndDateTime // void CTzDbRuleSet::GetRulesL(CTzRules& aTzRules, TInt aUtcOffset, const TDateTime& aStartDateTime, const TDateTime& aEndDateTime) const { TInt startYear = aStartDateTime.Year(); // the last year we are interested in is the earliest of the following: // 1) the last year of the CTzRules // 2) the year of aEndDateTime (the end of the invoking std time alignment) TInt endYear = (aEndDateTime.Year() < aTzRules.EndYear()) ? aEndDateTime.Year() : aTzRules.EndYear(); const TDateTime rulesEndDateTime(aTzRules.EndYear(), EDecember, 30, 0,0,0,0); const TDateTime& endDateTime = (aEndDateTime.Year() <= aTzRules.EndYear()) ? aEndDateTime : rulesEndDateTime; RArray<TTzRuleDefinition*> ruleDefs; CleanupClosePushL(ruleDefs); // PUSH #1 RArray<TTzRuleUse*> ruleUses; CleanupClosePushL(ruleUses); // PUSH #2 FetchRuleDefinitionsL(ruleDefs,ruleUses,startYear,endYear); // fetch rules for previous year (these will be needed to work out the "Old Offset" field of // the first rule in aStartYear TInt initialLocalTimeOffset = GetLocalTimeOffsetAtEndOfYearL(startYear-1,aUtcOffset); // convert rule definitions (together with rule uses) to TTzRules and add them to aTzRules CompleteRulesAndAddToCollectionL(aTzRules,ruleDefs,ruleUses,aUtcOffset,initialLocalTimeOffset,aStartDateTime,endDateTime); CleanupStack::PopAndDestroy(2,&ruleDefs); // POP #2,#1 - ruleUses, ruleDefs }
// ---------------------------------------------------- // CAlfExCalendarEngine::NumberOfEvents // ---------------------------------------------------- void CAlfExCalendarEngine::GetEventInformation( const TTime& aDate, TInt aIndex, TDes& aTextBuffer) { aTextBuffer.Zero(); TInt count = KErrNotFound; TDateTime requestedDate = aDate.DateTime(); const TInt arrayCount = iCalendarEventArray.Count(); for(TInt loop = 0; loop < arrayCount; loop++ ) { TDateTime eventDate = iCalendarEventArray[loop].iItemDay.DateTime(); if(eventDate.Day() == requestedDate.Day() && eventDate.Month() == requestedDate.Month() && eventDate.Year() == requestedDate.Year()) { count++; } if(aIndex == count) { aTextBuffer.Copy(iCalendarEventArray[loop].iItemText); loop = arrayCount; } } }
void CTzDbStdTimeAlignment::GetRulesL(CTzRules& aRules, const TDateTime& aStartDateTime, TDateTime& aEndDateTime) { // get the ruleSet for this time alignment CTzDbRuleSet* ruleSet = iReadOnlyTzDb.GetRuleSetL(iPersistedEntity.iOffsetToRuleSet); if (ruleSet) { CleanupStack::PushL(ruleSet); // PUSH #1 - RULESET // get end time of time alignment TTime endTime; CalculateEndTime(endTime); if (endTime == Time::MaxTTime()) { aEndDateTime.SetYear(KMaxTUint16); } else { aEndDateTime = endTime.DateTime(); } TInt firstYearOfInterest = (aRules.StartYear() >= aStartDateTime.Year()) ? aRules.StartYear() : aStartDateTime.Year(); TInt lastYearOfInterest = (aRules.EndYear() <= aEndDateTime.Year()) ? aRules.EndYear() : aEndDateTime.Year(); CTzRules* newRules = CTzRules::NewL(firstYearOfInterest, lastYearOfInterest); CleanupStack::PushL(newRules); // PUSH #2 - NEWRULES ruleSet->GetRulesL(*newRules,iPersistedEntity.iUtcOffset,aStartDateTime,aEndDateTime); // the new rules obtained for the current std time alignment must be merged into // the global rule collection AddRulesToCollectionL(aRules,*newRules); CleanupStack::PopAndDestroy(2, ruleSet); // POP #2,#1 - NEWRULES, RULESET } }
TBool CHttpHdrTest::CompareDate(TDateTime aDate1, TDateTime aDate2) { return ((aDate1.Year() == aDate2.Year()) && (aDate1.Month() == aDate2.Month()) && (aDate1.Day() == aDate2.Day()) && (aDate1.Hour() == aDate2.Hour()) && (aDate1.Minute() == aDate2.Minute()) && (aDate1.Second() == aDate2.Second()) && (aDate1.MicroSecond() == aDate2.MicroSecond())); }
// ----------------------------------------------------------------------------- // CCapInfo::WriteSolutionTagL() // Writes SyncSolutionsService solution data to capability object. // ----------------------------------------------------------------------------- // void CCapInfo::WriteSolutionTagL( const TDesC& aContentName, const TSConSolutionInfo& aSolution ) { TRACE_FUNC_ENTRY; _LIT( KFormatUID, "UID=0x%08x" ); _LIT( KFormatName, "Name=%S" ); _LIT( KFormatDate, "Timestamp=%04d%02d%02dT%02d%02d%02dZ" ); WriteTagL( EExt, TXmlParser::EElementBegin ); WriteValueL( EXNam, aContentName ); TFileName temp; temp.Format( KFormatUID, aSolution.iUid ); WriteValueL( EXVal, temp ); temp.Format( KFormatName, &aSolution.iSolutionName ); WriteValueL( EXVal, temp ); if ( aSolution.iTime.Int64() != 0 ) { // write time TDateTime time = aSolution.iTime.DateTime(); temp.Format( KFormatDate, time.Year(), time.Month() + 1, time.Day() + 1, time.Hour(), time.Minute(), time.Second() ); WriteValueL( EXVal, temp ); } WriteTagL( EExt, TXmlParser::EElementEnd ); TRACE_FUNC_EXIT; }
void MemSpyEngineUtils::FormatTimeSimple( TDes& aBuf, const TTime& aTime ) { const TDateTime dt = aTime.DateTime(); // _LIT( KTimeFormatSpec, "%04d%02d%02d %02d:%02d:%02d" ); aBuf.Format( KTimeFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second() ); }
// --------------------------------------------------------------------------- // TPresCondValidity::LogDateTime() // --------------------------------------------------------------------------- // void TPresCondValidity::LogDateTime(TDateTime aDateTime) { OPENG_DP(D_OPENG_LIT( " %d, %d, %d, %d, %d, %d, %d"), aDateTime.Year(), aDateTime.Month()+1, aDateTime.Day()+1, aDateTime.Hour(), aDateTime.Minute(), aDateTime.Second(), aDateTime.MicroSecond() ); }
void CTestTransaction::WriteDateStamp(const TDateTime &aDate) { TDateTime date; TTime now; TBool iEOL = (aDate.Year() == K_OUTOFBOUNDS_YEAR); if (iEOL) { now.HomeTime(); date = now.DateTime(); } else date = aDate; TTime t(date); TBuf<128> dateTimeString; TRAPD(err, t.FormatL(dateTimeString, KDateFormat)); if (err == KErrNone) { if (iEOL) Machine()->MsgPrintf(_L("[%S] "), &dateTimeString); else Log(_L("[%S]\r\n"), &dateTimeString); } }
static struct tm& as_struct_tm (const time_t& t, struct tm& res) { TTime us = UNIX_BASE + TTimeIntervalSeconds(t); TDateTime dt = us.DateTime(); res.tm_sec = dt.Second(); res.tm_min = dt.Minute(); res.tm_hour = dt.Hour(); res.tm_mday = dt.Day() + 1; res.tm_mon = dt.Month(); res.tm_year = dt.Year() - 1900; // EPOC32 counts the year day as Jan 1st == day 1 res.tm_yday = us.DayNoInYear() - 1; // EPOC32 counts the weekdays from 0==Monday to 6==Sunday res.tm_wday = us.DayNoInWeek() + 1; if (res.tm_wday==7) res.tm_wday=0; // Sunday==0 in a struct tm // newlib just sets this field to -1 // tm_isdst doesn't really make sense here since we don't // know the locale for which to interpret this time. res.tm_isdst = -1; return res; }
TVerdict CTestImpBDay::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual */ { SetTestStepResult(EFail); TInt numberOfCases = 0; while(ETrue) { TBuf<90> config(KImportBDay); TPtrC ptrexpUTC = GetExpectedUTCFromIniL(numberOfCases, config, ETrue); if(ptrexpUTC==KNullDesC) { break; } INFO_PRINTF2(_L("TEST: %d"), numberOfCases+1); iExpectedBDay = FormatDateTime(ptrexpUTC); TBuf<90> pathVCF(KPathImportBDay); OpenBDAYVCFAndImportItemL(pathVCF, numberOfCases); // Imports vcf TDateTime importedDateTime = iBDayFromImport.DateTime(); TDateTime expectedDateTime = iExpectedBDay.DateTime(); // If birthday does not match, test will fail if((importedDateTime.Year() != expectedDateTime.Year()) || (importedDateTime.Month() != expectedDateTime.Month()) || (importedDateTime.Day() != expectedDateTime.Day()) ) { INFO_PRINTF1(_L("Imported Birthday not correct")); SetTestStepResult(EFail); return TestStepResult(); } else { INFO_PRINTF1(_L("Imported Birthday as expected")); SetTestStepResult(EPass); } numberOfCases++; } return TestStepResult(); }
// ---------------------------------------------------- // CAlfExCalendarEngine::NumberOfEvents // ---------------------------------------------------- TInt CAlfExCalendarEngine::NumberOfEvents(const TTime& aDate) { TInt count = 0; TDateTime requestedDate = aDate.DateTime(); const TInt arrayCount = iCalendarEventArray.Count(); for(TInt loop = 0; loop < arrayCount; loop++) { TDateTime eventDate = iCalendarEventArray[loop].iItemDay.DateTime(); if(eventDate.Day() == requestedDate.Day() && eventDate.Month() == requestedDate.Month() && eventDate.Year() == requestedDate.Year()) { count++; } } return count; }
void TAzenqosEngineUtils::MakeTimeStrMilli(TTime &time,TDes& str) //str should be at least 19 in length { const TInt KThousand = 1000; TDateTime date = time.DateTime(); str.Format(KTimeStampMillisecFormat,date.Year()%2000,date.Month()+1,date.Day()+1,date.Hour(),date.Minute(),date.Second(),date.MicroSecond()*KThousand); }
// ---------------------------------------------------- // CAlfExCalendarEngine::EventsAvailable // ---------------------------------------------------- TBool CAlfExCalendarEngine::EventsAvailable(const TTime& aDate) { TBool ret( EFalse ); TDateTime requestedDate = aDate.DateTime(); const TInt arrayCount = iCalendarEventArray.Count(); for(TInt loop = 0; loop < arrayCount; loop++) { TDateTime eventDate = iCalendarEventArray[loop].iItemDay.DateTime(); if(eventDate.Day() == requestedDate.Day() && eventDate.Month() == requestedDate.Month() && eventDate.Year() == requestedDate.Year()) { ret = ETrue; break; } } return ret; }
TBool CTestExBDayLocal::CheckImportedBDay() { TDateTime importedDateTime = iBDayFromImport.DateTime(); TDateTime exportedDateTime = iBDayLocal.DateTime(); //checks if exported and imported birthday macthes, which it should, otherwise test failed if((importedDateTime.Year() != exportedDateTime.Year()) || (importedDateTime.Month() != exportedDateTime.Month()) || (importedDateTime.Day() != exportedDateTime.Day()) ) { INFO_PRINTF1(_L("Export and Import of birthday does not match (incorrect)")); return EFalse; } else { INFO_PRINTF1(_L("Export and Import of birthday macthes (correct)")); return ETrue; } }
void CTzDbRuleSet::ActualiseRuleDefinitionsL(CVTzActualisedRules& aActualisedRules, const RArray<TTzRuleDefinition*>& aTzRuleDefinitions, const RArray<TTzRuleUse*>& aTzRuleUses, TInt aUtcOffset, const TDateTime& aStartDateTime, const TDateTime& aEndDateTime, const TVTzActualisedRule& aDefaultRule) const { TInt startYear = aStartDateTime.Year(); TInt endYear = (aActualisedRules.EndYear() < (TUint)aEndDateTime.Year()) ? aActualisedRules.EndYear() : aEndDateTime.Year(); TInt rulesAddedSoFar = 0; TInt yearOfFirstRule = endYear; TInt count = aTzRuleDefinitions.Count(); TInt oldOffset = 0; // Arbitrarily set to zero. Required to create TTzRule. for (TInt i = 0; i < count; i++) { for (TInt year = (startYear > aTzRuleUses[i]->iFromYear) ? startYear : aTzRuleUses[i]->iFromYear ; (year <= endYear) && (year <= aTzRuleUses[i]->iUntilYear); year++) { TTzRule trule( static_cast<TUint16>(startYear), static_cast<TUint16>(endYear), static_cast<TUint16>(oldOffset), static_cast<TUint16>(aUtcOffset + aTzRuleDefinitions[i]->iStdTimeOffset),static_cast<TMonth>(aTzRuleDefinitions[i]->iMonth), static_cast<TTzRuleDay>(aTzRuleDefinitions[i]->iDayRule), static_cast<TUint8>(aTzRuleDefinitions[i]->iDayOfMonth), static_cast<TUint8>(aTzRuleDefinitions[i]->iDayOfWeek), static_cast<TTzTimeReference>(aTzRuleDefinitions[i]->iTimeReference), static_cast<TTzTimeReference>(aTzRuleDefinitions[i]->iTimeOfChange)); TVTzActualisedRule tActRule = trule.Actualise(year); if ( (tActRule.iTimeOfChange < aEndDateTime) && (tActRule.iTimeOfChange >= aStartDateTime) ) { aActualisedRules.AddRuleL(tActRule); // record the year of the first rule added if (rulesAddedSoFar == 0) { yearOfFirstRule = year; } rulesAddedSoFar++; } } } // In some cases we need to add a "default rule" to aRules. ("Default rule" // means a rule with zero as DST offset and the start-time of the time-alignment // as time-of-change). This default rule will be added if no rule exists for the // first year of the time alignment. if ( (rulesAddedSoFar == 0) || (yearOfFirstRule > startYear) ) { aActualisedRules.AddRuleL(aDefaultRule); } }
//------------------------------------------------------ // Class: TChineseCalendar // Function: DateTimeToChinese // Arguments: TDateTime & // // Comments: Sets the date held in the given TDateTime // class to the TChineseCalendar class // // Return: void //------------------------------------------------------ EXPORT_C void TChineseCalendar::DateTimeToChinese(const TDateTime &aDT) { TArithmeticalDate gregDate; TGregorianCalendar greg; gregDate.iDay = aDT.Day() + KCalConvMonthOffsetByOne; gregDate.iMonth = (TInt)aDT.Month() + KCalConvMonthOffsetByOne; gregDate.iYear = aDT.Year(); iJulianDay = greg.GregToJulianDay(gregDate); }
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; }
void CMemSpyEngineSinkMetaData::ConstructL( const TDesC& aRoot, const TDesC& aContext, const TDesC& aFolder, const TDesC& aExtension, const TTime& aFolderTime ) { iRoot = aRoot.AllocL(); iContext = aContext.AllocL(); iFolder = aFolder.AllocL(); iExtension = aExtension.AllocL(); const TDateTime dt = aFolderTime.DateTime(); HBufC* spec = HBufC::NewLC( KMaxFileName ); TPtr pName( spec->Des() ); pName.Format( KMemSpyDataStreamFolderNameFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second()); iFolderTimeStamp = pName.AllocL(); CleanupStack::PopAndDestroy( spec ); }
void CDTSYLogger::WriteRecord(const TDesC8& aText) { if(iValid) { TBuf8<KGenericBufferSize> buf; TTime now; now.UniversalTime(); TDateTime dateTime; dateTime = now.DateTime(); buf.Format(_L8 ("%04d/%02d/%02d %02d.%02d:%02d:%06d "),dateTime.Year(),dateTime.Month()+1, dateTime.Day()+1,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond()); buf.AppendFormat(_L8("%S\015\012"),&aText); iFile.Write(buf); iFile.Flush(); } }
/* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ TUint32 CZipCompressor::MsDosDateTime( TTime aTime ) { TDateTime dateTime = aTime.DateTime(); TUint8 day = dateTime.Day() + 1; TUint8 month = dateTime.Month() + 1; TUint8 year = dateTime.Year() - 1980; TUint8 seconds = dateTime.Second(); TUint8 minutes = dateTime.Minute(); TUint8 hours = dateTime.Hour(); TUint32 date = 0; date |= ( year & 0x3f ) << 9; date |= ( month & 0x0f ) << 5; date |= ( day & 0x1f ); date <<= 16; date |= ( hours & 0x1f ) << 11; date |= minutes << 5; date |= seconds >> 1; return date; }
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; }
// --------------------------------------------------------------------------- // CGpxConverterAO::WriteStartingTags // Writes header tags for GPX file // --------------------------------------------------------------------------- void CGpxConverterAO::WriteStartingTags() { LOG("CGpxConverterAO::WriteStartingTags ,begin"); TPtr8 writePtr = iWriteBuf->Des(); TPtr formatter = iFormatBuf->Des(); // write starting tags writePtr.Copy( KTagXml ); writePtr.Append( KTagGpxStart ); iGpxFile.Write( writePtr ); writePtr.Copy( KTagMetaStart ); formatter.Format( KTagName, &iGpxFileName ); writePtr.Append( formatter ); iGpxFile.Write( writePtr ); TTime timeStamp( 0 ); timeStamp.UniversalTime(); TDateTime datetime = timeStamp.DateTime(); formatter.Format( KTagTimeStamp, datetime.Year(), datetime.Month() + 1, datetime.Day() + 1, datetime.Hour(), datetime.Minute(), datetime.Second() ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); if ( iBoundaries ) { formatter.Format( KTagBounds, iBoundaries->minLatitude, iBoundaries->minLongitude, iBoundaries->maxLatitude, iBoundaries->maxLongitude ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); } writePtr.Copy( KTagMetaEnd ); iGpxFile.Write( writePtr ); writePtr.Copy( KTagTrackStart ); iGpxFile.Write( writePtr ); LOG("CGpxConverterAO::WriteStartingTags ,end"); }
// ----------------------------------------------------------------------------- // CTFAStifTestLog::ConstructL // ----------------------------------------------------------------------------- void CTFAStifTestLog::ConstructL( void ) { TFileName fileName; TTime time; time.HomeTime(); TDateTime dateTime = time.DateTime(); RThread thread; #ifdef __LOG_HTML__ _LIT( KSuffix, "html" ); #else _LIT( KSuffix, "txt" ); #endif fileName.Format( _L( "%02d%02d%02d_%02d%02d%02d_%x.%S" ), dateTime.Year() - 2000, dateTime.Month() + 1, dateTime.Day() + 1, dateTime.Hour(), dateTime.Minute(), dateTime.Second(), (TUint)thread.Id(), &KSuffix ); iLogger = CStifLogger::NewL( _L( "c:\\logs\\testframework\\" ), fileName, CStifLogger::ETxt, CStifLogger::EFile, ETrue, EFalse, EFalse, EFalse, EFalse ); iOverflowHandler = new ( ELeave ) TTFAOverflowHandler; #ifdef __LOG_HTML__ iLogger->Log( _L8( "<html><head><title>TFA Log</title></head>\r\n<body>\r\n" ) ); #endif }
const wchar *C_dir::ScanGet(dword *atts, dword *size, S_date_time *dt){ if(!find_data) return NULL; S_scan_data *sd = (S_scan_data*)find_data; if(sd->index >= sd->count) return NULL; const TEntry &e = (*sd->list)[sd->index++]; if(atts){ *atts = 0; if(e.IsArchive()) *atts |= C_file::ATT_ARCHIVE; if(e.IsHidden()) *atts |= C_file::ATT_HIDDEN; if(e.IsReadOnly()) *atts |= C_file::ATT_READ_ONLY; if(e.IsSystem()) *atts |= C_file::ATT_SYSTEM; if(e.IsDir()) *atts |= C_file::ATT_DIRECTORY; } if(size) *size = e.iSize; if(dt){ const TDateTime st = e.iModified.DateTime(); dt->year = word(st.Year()); dt->month = word(st.Month()); dt->day = word(st.Day()); dt->hour = word(st.Hour()); dt->minute = word(st.Minute()); dt->second = word(st.Second()); dt->sort_value = dt->GetSeconds() + dt->GetTimeZoneMinuteShift()*60; dt->SetFromSeconds(dt->sort_value); dt->sort_value = dt->GetSeconds(); } TFileName fn = e.iName; sd->tmp = (const wchar*)fn.PtrZ(); return sd->tmp; }
TVerdict CTestExRevUTC::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual */ { SetTestStepResult(EFail); TBuf<90> pathVCF(KExportRevUTCFile); ExportItemL(pathVCF, EFalse); // read from the disk. ImportItemL(pathVCF,EFalse); TDateTime t = iRecordedTime.DateTime(); TDateTime t1 = iTimeFromImport.DateTime(); INFO_PRINTF7(_L("Recorded Last Modified Date Year: %d, Month: %d, Day: %d, Recorded Time Hr: %d, Min: %d, Sec: %d "), t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()); INFO_PRINTF7(_L("Imported Last Modified Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second()); TTimeIntervalSeconds secondsDifference; User::LeaveIfError(iTimeFromImport.SecondsFrom(iRecordedTime, secondsDifference)); TInt difference = secondsDifference.Int(); if (difference < 2 && difference > -2) { INFO_PRINTF1(_L("Recorded and Imported DateTime match")); SetTestStepResult(EPass); } else { INFO_PRINTF1(_L("Recorded and Imported DateTime does not match")); SetTestStepResult(EFail); } return TestStepResult(); }
TVerdict CTestImpRevLocal::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual */ { SetTestStepResult(EFail); TInt numberOfCases = 0; while(ETrue) { TBuf<90> config(KImportRevLocal); TPtrC ptrexpUTC = GetExpectedUTCFromIniL(numberOfCases, config, EFalse); if(ptrexpUTC==KNullDesC) { break; } INFO_PRINTF2(_L("TEST: %d"), numberOfCases+1); iExpectedUTC = FormatDateTime(ptrexpUTC); TBuf<80> pathVCF(KPathImportRevLocal); OpenVCFAndImportItemL(pathVCF, iFsSession, numberOfCases); // Imports vcf TDateTime t = iTimeFromImport.DateTime(); TDateTime t1 = iExpectedUTC.DateTime(); INFO_PRINTF7(_L("Imported Date Year: %d, Month: %d, Day: %d, Imported Time Hr: %d, Min: %d, Sec: %d "), t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()); INFO_PRINTF7(_L("Expected Date Year: %d, Month: %d, Day: %d, Expected Time Hr: %d, Min: %d, Sec: %d "), t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second()); if (iExpectedUTC==iTimeFromImport) // checks if imported time is correct { INFO_PRINTF1(_L("Imported Time as local (correct)")); SetTestStepResult(EPass); } else { INFO_PRINTF1(_L("Imported Time not imported as local (NOT CORRECT)")); SetTestStepResult(EFail); return TestStepResult(); } numberOfCases++; } return TestStepResult(); }
void CDummyCalendarApp::AddEntryL(TInt aNumToAdd, TBool isParent, TBool isRepeat) { test.Next(_L("Adding entries")); TBuf<50> summary; TBuf<50> location; TBuf<50> description; iEntries.ResetAndDestroy(); for (TInt index=0; index<aNumToAdd; index++) { TBuf8<255> buf; buf.Append(_L("GuidId")); buf.AppendNum(index); HBufC8* guid = buf.AllocLC(); // need to be pushed to ... CCalEntry::TType entryType=(index%2==0)?CCalEntry::ETodo:CCalEntry::EAppt; CCalEntry* entry = NULL; if(isParent) { entry = CreateCalEntryL(entryType, guid); } else { TTime localTime(KRecurrIdLocalTime); TCalTime recurrenceId; recurrenceId.SetTimeLocalL(localTime); entry = CCalEntry::NewL(entryType, guid, CCalEntry::EMethodAdd, 1, recurrenceId, CalCommon::EThisAndFuture); } CleanupStack::Pop(guid); iEntries.AppendL(entry); TInt year = -1; TInt month = -1; TInt day = -1; if (isParent) { year = index % 5 + 2001; // Any year in the range: 2001 - 2005 month = index % 12; day = index % 28; } else { // if this is a child entry, use the recurrence local time as the entry start time // so it won't be out of range TCalTime recurrId = entry->RecurrenceIdL(); TDateTime localTime = recurrId.TimeLocalL().DateTime(); year = localTime.Year(); month = localTime.Month(); day = localTime.Day(); } TTime start(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0)); TTime end(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0)); end += TTimeIntervalDays(1); SetEntryStartAndEndTimeL(entry,start,end); RandomText(summary); entry->SetSummaryL(summary); RandomText(location); entry->SetLocationL(location); RandomText(description); entry->SetDescriptionL(description); if(isRepeat) { //create a daily repeat rule and make sure its repeat start\end date is within the deleting time range TCalRRule rpt(TCalRRule::EDaily); rpt.SetInterval(1); TCalTime repeatStart; TCalTime repeatend; if(isParent) { //make sure the repeat time is within the delete time range repeatStart.SetTimeLocalL(TDateTime(2000, EJune, 0, 0, 0, 0, 0)); repeatend.SetTimeLocalL(TDateTime(2006, EJune, 0, 0, 0, 0, 0)); } else if (index<aNumToAdd/2) { // if this is a child entry, use the entry's recurrance time as repeating rule // start time TCalTime recurrId = entry->RecurrenceIdL(); // make sure the repeat time is within the delete time range for the first half entries repeatStart.SetTimeLocalL(recurrId.TimeLocalL()); // June 1, 2003 00:00:00 repeatend.SetTimeLocalL(recurrId.TimeLocalL() + TTimeIntervalMonths(1)); // July 1, 2003 00:00:00 } else { //make sure the repeat time is out of the delete time range for the second half entries repeatStart.SetTimeLocalL(TDateTime(2003, EJune, 0, 0, 0, 0, 0)); repeatend.SetTimeLocalL(TDateTime(2007, EJune, 0, 0, 0, 0, 0)); } rpt.SetDtStart(repeatStart); rpt.SetUntil(repeatend); entry->SetRRuleL(rpt); } } TInt entriesStored(0); iLocalEntryView->StoreL(iEntries, entriesStored); //temp test(entriesStored == iEntries.Count()); }
// print a date and time to log in a readable format: void LbsTestUtilities::PrintfDateTimeToDebugLog(TTime aTime) { TDateTime datetime = aTime.DateTime(); TESTLOG8(ELogP2,"%d :%d :%d :%d on %d/%d/%d", datetime.Hour(), datetime.Minute(), datetime.Second(), datetime.MicroSecond(), datetime.Day() + 1, datetime.Month() + 1, datetime.Year()); }
// --------------------------------------------------------------------------- // CGpxConverterAO::WriteItemToFile // Writes single trackpoint to GPX file // --------------------------------------------------------------------------- void CGpxConverterAO::WriteItemToFile() { LOG("CGpxConverterAO::WriteItemToFile ,begin"); TTime timeStamp; TPtr8 writePtr = iWriteBuf->Des(); TPtr formatter = iFormatBuf->Des(); if ( Math::IsNaN(iTempItem.iLatitude) || Math::IsNaN(iTempItem.iLongitude) ) { if ( !iFixLost ) { writePtr.Copy( KTagSegmentEnd ); iGpxFile.Write( writePtr ); iFixLost = ETrue; } } else { if ( iFixLost ) { writePtr.Copy( KTagSegmentStart ); iGpxFile.Write( writePtr ); iFixLost = EFalse; } // write single track point // coordinates formatter.Format( KTagTrkPointStart, iTempItem.iLatitude, iTempItem.iLongitude ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); // elevation if ( !Math::IsNaN( iTempItem.iAltitude )) { formatter.Format( KTagElevation, iTempItem.iAltitude ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); } // course if ( !Math::IsNaN( iTempItem.iCourse )) { formatter.Format( KTagCourse, iTempItem.iCourse ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); } timeStamp = iTempItem.iTimeStamp; TDateTime datetime = timeStamp.DateTime(); formatter.Format( KTagTimeStamp, datetime.Year(), datetime.Month() + 1, datetime.Day() + 1, datetime.Hour(), datetime.Minute(), datetime.Second() ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); if ( !Math::IsNaN( iTempItem.iAltitude )) { writePtr.Copy( KTagFix3D ); iGpxFile.Write( writePtr ); } else { writePtr.Copy( KTagFix2D ); iGpxFile.Write( writePtr ); } // number of satellites formatter.Format( KTagSatellites, iTempItem.iNumSatellites ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); // accuracy (hdop, vdop) if ( !Math::IsNaN( iTempItem.iHdop )) { formatter.Format( KTagHdop, iTempItem.iHdop ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); } if ( !Math::IsNaN( iTempItem.iVdop )) { formatter.Format( KTagVdop, iTempItem.iVdop ); writePtr.Copy( formatter ); iGpxFile.Write( writePtr ); } // end track point writePtr.Copy( KTagTrkPointEnd ); iGpxFile.Write( writePtr ); } LOG("CGpxConverterAO::WriteItemToFile ,end"); }
TVerdict CTestExBDayLocal::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual */ { SetTestStepResult(EFail); TInt numberOfCases = 0; while (ETrue) { TPtrC ptrBDay = GetBDayL(numberOfCases); if(ptrBDay==KNullDesC) { break; } INFO_PRINTF2(_L("TEST: %d"), numberOfCases+1); iBDayLocal = FormatDateTime(ptrBDay); TDateTime t = iBDayLocal.DateTime(); INFO_PRINTF7(_L("Birthday to be exported, Year: %d, Month: %d, Day: %d, Hr: %d, Min: %d, Sec: %d"), t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()); iName = GetNameL(numberOfCases); iPhone = GetPhoneL(numberOfCases); TBuf<90> pathVCF(KExportBDayFile); ExportItemL(pathVCF, ETrue); // read from the disk. ImportItemL(pathVCF, ETrue); if(!CheckImportedBDay()) { SetTestStepResult(EFail); return TestStepResult(); } numberOfCases++; }// End Of While Loop SetTestStepResult(EPass); return TestStepResult(); }