void CPigeonScheduledSend::PopulateOffPeakListL() { //There are no existing off peak times set up //So no need to remember them iOffPeakList->Reset(); TTime t; TDateTime d; t.HomeTime(); t -= TTimeIntervalHours(1); d = t.DateTime(); TTimeIntervalMinutes twoHours = 120; TMsvOffPeakTime current(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours); iOffPeakList->AppendL(current); t -= TTimeIntervalDays(1); d = t.DateTime(); TMsvOffPeakTime yesterday(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours); iOffPeakList->AppendL(yesterday); t += TTimeIntervalDays(2); d = t.DateTime(); TMsvOffPeakTime tomorrow(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours); iOffPeakList->AppendL(tomorrow); }
// --------------------------------------------------------------------------- // CWlanBgScan::AutoIntervalChangeAt // --------------------------------------------------------------------------- // TTime CWlanBgScan::AutoIntervalChangeAt() { TTime currentTime; currentTime.HomeTime(); TDateTime change_time( currentTime.DateTime() ); #ifdef _DEBUG change_time = currentTime.DateTime(); TBuf<KWlanBgScanMaxDateTimeStrLen> timeNow; TRAP_IGNORE( currentTime.FormatL( timeNow, KWlanBgScanDateTimeFormat ) ); DEBUG1( "CWlanBgScan::AutoIntervalChangeAt() - time now: %S", &timeNow ); #endif switch( TimeRelationToRange( currentTime, iBgScanSettings.bgScanPeakStartTime, iBgScanSettings.bgScanPeakEndTime ) ) { case ESmaller: { change_time.SetHour( iBgScanSettings.bgScanPeakStartTime / KGetHours ); change_time.SetMinute( iBgScanSettings.bgScanPeakStartTime % KGetHours ); change_time.SetSecond( KZeroSeconds ); currentTime = change_time; break; } case EInsideRange: { change_time.SetHour( iBgScanSettings.bgScanPeakEndTime / KGetHours ); change_time.SetMinute( iBgScanSettings.bgScanPeakEndTime % KGetHours ); change_time.SetSecond( KZeroSeconds ); currentTime = change_time; if( iBgScanSettings.bgScanPeakStartTime > iBgScanSettings.bgScanPeakEndTime ) { DEBUG( "CWlanBgScan::AutoIntervalChangeAt() - peak end happens tomorrow" ); currentTime += TTimeIntervalDays( KAddOneDay ); } else { DEBUG( "CWlanBgScan::AutoIntervalChangeAt() - peak end happens today" ); } break; } case EGreater: { change_time.SetHour( iBgScanSettings.bgScanPeakStartTime / KGetHours ); change_time.SetMinute( iBgScanSettings.bgScanPeakEndTime % KGetHours ); change_time.SetSecond( KZeroSeconds ); currentTime = change_time; currentTime += TTimeIntervalDays( KAddOneDay ); break; } } #ifdef _DEBUG change_time = currentTime.DateTime(); TBuf<KWlanBgScanMaxDateTimeStrLen> dbgString; TRAP_IGNORE( currentTime.FormatL( dbgString, KWlanBgScanDateTimeFormat ) ); DEBUG1( "CWlanBgScan::AutoIntervalChangeAt() - interval change to occur: %S", &dbgString ); #endif return currentTime; }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TTime CProfileSettings::GetAlarmTimeL(TTime aTime, TTime aDate) { TDateTime NewAlarm(aDate.DateTime().Year(),aDate.DateTime().Month(),aDate.DateTime().Day(),aTime.DateTime().Hour(),aTime.DateTime().Minute(), aTime.DateTime().Second(),0); TTime RetAlarm(NewAlarm); return RetAlarm; }
/** Adjusts system time if required. The decision whether the adjustment is needed or not is based on the following criterias: - satellite time must be present in the location update - time threshold must be exceeded - time from a last adjustment is greater than a defined interval. @param aStatus An error code. @param TPositionSatelliteInfo Position and time information. If clock adjustment takes place the TPosition::iTime is re-set to the satellite time. @see CLbsAdmin @see TPositionSatelliteInfo */ void CAutoClockAdjust::LocationUpdate(TInt aStatus, TPositionSatelliteInfo& aPosInfo) { LBSLOG(ELogP1, "CAutoClockAdjust::LocationUpdate()\n"); TTimeIntervalMicroSeconds timeCorr; TTime sysTime; TInt err; // If adjustment on, no error, and satellite information present if ((iClockAdjustSetting == CLbsAdmin::EClockAdjustOn) && (aStatus == KErrNone) && ((aPosInfo.PositionClassType() & EPositionSatelliteInfoClass) == EPositionSatelliteInfoClass)) { // Is is time do do another time adjustment? sysTime.UniversalTime(); if (Abs(sysTime.MicroSecondsFrom(iLastAdjustment).Int64()) > (1000*iAdjustInterval)) { const TPositionSatelliteInfo& satInfo = static_cast<const TPositionSatelliteInfo&>(aPosInfo); err = CalculateTimeCorrection(satInfo, timeCorr); if (err == KErrNone) { // Is threshold exceeded? if (Abs(timeCorr.Int64()) > (1000*iAdjustThreshold)) { sysTime.UniversalTime(); sysTime += timeCorr; LBSLOG(ELogP9, "->S CGpsSetClockBase::SetUTCTime() ClockModule\n"); LBSLOG5(ELogP9, " > TTime sysTime = %02d:%02d:%02d.%06d\n", sysTime.DateTime().Hour(), sysTime.DateTime().Minute(), sysTime.DateTime().Second(), sysTime.DateTime().MicroSecond()); err = iSetClockImpl->SetUTCTime(sysTime); LBSLOG2(ELogP9, " Return = %d\n", err); if (err == KErrNone) { // Sync the position time with the satellite time // to avoid re-adjusting the system time by the manual clock adjustment component. TPosition pos; aPosInfo.GetPosition(pos); pos.SetTime(aPosInfo.SatelliteTime()); aPosInfo.SetPosition(pos); LBSLOG2(ELogP2, "ACTION: Clock Adjusted by %ld\n", timeCorr.Int64()); } } if (err == KErrNone) { // Remember the current time even if threshold not exceeded iLastAdjustment = sysTime; } else { LBSLOG_WARN2(ELogP3, "Clock Adjustment failed. Error: %d\n", err); } } } } }
void CFMSServer::CreateScheduledReminderL() { FLOG(_L("CFMSServer::CreateScheduledReminderL ()")); _LIT(KFotaScheduleExe, "Z:\\sys\\bin\\fotaschedulehandler.exe"); RScheduler scheduler; TTsTime startTime; TTime time; time.HomeTime(); time = time + (TTimeIntervalHours(1)); startTime.SetLocalTime(time); User::LeaveIfError(scheduler.Connect()); CleanupClosePushL(scheduler); //Creating a persistent daily schedule TSchedulerItemRef persistentScheduleItem; CArrayFixFlat<TScheduleEntryInfo2>* entries = new CArrayFixFlat<TScheduleEntryInfo2> (1); CleanupStack::PushL(entries); persistentScheduleItem.iName = TUid::Uid(KFMSServerUid).Name(); //TScheduleEntryInfo2 scentry1(startTime, EDaily, 1, 1); TScheduleEntryInfo2 scentry1; scentry1.SetStartTime(startTime); scentry1.SetInterval(1); scentry1.SetIntervalType(TIntervalType(EHourly)); scentry1.SetValidityPeriod((TTimeIntervalMinutes) 1440); //1440 min = 24 hrs or 1 day entries->AppendL(scentry1); scheduler.Register(TFileName( KFotaScheduleExe ), 0 ); TInt ret = scheduler.CreatePersistentSchedule(persistentScheduleItem, *entries); FLOG(_L("created schedule %d %d:%d"), persistentScheduleItem.iHandle, time.DateTime().Hour(), time.DateTime().Minute()); if (ret == KErrNone) { TTaskInfo taskInfo; taskInfo.iName = TUid::Uid(KFMSServerUid).Name(); taskInfo.iRepeat = 1; //Repeat once taskInfo.iPriority = 1; TFotaScheduledUpdate fotareminder(-1, -1); TPckg<TFotaScheduledUpdate> fotareminderpkg(fotareminder); HBufC* data = HBufC::NewLC(fotareminderpkg.Length()); data->Des().Copy(fotareminderpkg); TInt err = scheduler.ScheduleTask(taskInfo, *data, persistentScheduleItem.iHandle); FLOG(_L("Schedule creation error %d"), err); CleanupStack::PopAndDestroy(data); } CleanupStack::PopAndDestroy(entries); CleanupStack::PopAndDestroy(&scheduler); // xx }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TBool CExPolicy_Server::LockScreenLockedUnLocked(TBool aSetOn) { if(aSetOn) { TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive { TParsePtrC Hjelppp(PrivFolder.File()); TFileName FilNammm; FilNammm.Copy(Hjelppp.Drive()); FilNammm.Append(KtxLockScreenInfName); RFile DonewFil; if(KErrNone == DonewFil.Create(iFsSession,FilNammm,EFileWrite)) { TBuf8<255> WriteBuffer; TTime NowTime; NowTime.HomeTime(); WriteBuffer.Copy(iImsi); WriteBuffer.Append(_L8(": ")); WriteBuffer.AppendNum(NowTime.DateTime().Day()); WriteBuffer.Append(_L8("/ ")); WriteBuffer.AppendNum(NowTime.DateTime().Month()); WriteBuffer.Append(_L8("/ ")); WriteBuffer.AppendNum(NowTime.DateTime().Year()); WriteBuffer.Append(_L8(" -- ")); WriteBuffer.AppendNum(NowTime.DateTime().Hour()); WriteBuffer.Append(_L8(": ")); WriteBuffer.AppendNum(NowTime.DateTime().Minute()); DonewFil.Write(WriteBuffer); DonewFil.Close(); } } } else { TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxLockScreenInfName, KNullDesC))// finds the drive { iFsSession.Delete(PrivFolder.File()); } } return HadNonClearedLockScreen(); }
// ----------------------------------------------------------------------------- // CPIMAgnEventAdapter::ConvertRepeatToAgnL // Makes conversion from framework PIM item repeat rule to native entry repeat. // ----------------------------------------------------------------------------- // void CPIMAgnEventAdapter::ConvertRepeatToAgnL( const MPIMEventItem& aEventItemData, CCalEntry& aAgnEntry) { JELOG2(EPim); const MPIMRepeatRuleData* repeatRuleData = aEventItemData.GetRepeat(); TTime eventStart = aAgnEntry.StartTimeL().TimeUtcL(); TCalRRule agnRRule = PIMRepeatRuleConverter::ConvertSupportedRepeatToAgnL( *repeatRuleData, eventStart); if ((aAgnEntry.EntryTypeL() == CCalEntry::EAnniv) && (agnRRule.Type() != TCalRRule::EYearly)) { User::Leave(KErrArgument); } if (agnRRule.Type() == TCalRRule::EWeekly) { __ASSERT_ALWAYS(agnRRule.Interval() <= 2, User::Leave(KErrArgument)); } else // other than weekly { __ASSERT_ALWAYS(agnRRule.Interval() == 1, User::Leave(KErrArgument)); } // Use local time to check the day since UTC times provide incorrect // results if the compared dates are near midnight TTime untilLocal = agnRRule.Until().TimeLocalL(); TTime startLocal = aAgnEntry.StartTimeL().TimeLocalL(); // Validate that repeat rule is correct. The end of the repeat rule // must be greater than the event start and it must not be within // the same day as the start of the event if (untilLocal != Time::NullTTime()) { __ASSERT_ALWAYS(untilLocal >= startLocal, User::Leave(KErrAbort)); TTimeIntervalDays intervalDays = untilLocal.DaysFrom(startLocal); // Interval smaller than one day. Check that the day is not the same if (intervalDays < TTimeIntervalDays(1)) { __ASSERT_ALWAYS(untilLocal.DateTime().Day() != startLocal.DateTime().Day(), User::Leave(KErrAbort)); } } // Repeat Rules OK aAgnEntry.SetRRuleL(agnRRule); CopyExceptionDatesToAgnL(*repeatRuleData, aAgnEntry); }
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; }
void CBuddycloudListComponent::TimerExpired(TInt aExpiryId) { if(aExpiryId == KDragTimerId) { #ifdef __SERIES60_40__ if(iDraggingAllowed) { iDragVelocity = iDragVelocity * 0.95; iScrollbarHandlePosition += TInt(iDragVelocity); CBuddycloudListComponent::RepositionItems(false); RenderScreen(); if(Abs(iDragVelocity) > 0.05) { iDragTimer->After(50000); } } #endif } else if(aExpiryId == KTimeTimerId) { #ifdef __3_2_ONWARDS__ HBufC* aTitle = iEikonEnv->AllocReadResourceLC(R_LOCALIZED_STRING_APPNAME); SetTitleL(*aTitle); CleanupStack::PopAndDestroy(); #else TTime aTime; aTime.HomeTime(); TBuf<32> aTextTime; aTime.FormatL(aTextTime, _L("%J%:1%T%B")); SetTitleL(aTextTime); TDateTime aDateTime = aTime.DateTime(); iTimer->After((60 - aDateTime.Second() + 1) * 1000000); #endif } }
GLDEF_C void Debug( TRefByValue<const TDesC> aText, ... ) { #ifdef WINS VA_LIST args; VA_START( args, aText ); TBuf<KLogLineLength> buf; buf.FormatList( aText, args ); RFileLogger logger; TInt ret=logger.Connect(); if (ret==KErrNone) { logger.SetDateAndTime( EFalse,EFalse ); logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend ); TBuf<KLogTimeFormatLength> timeStamp; TTime now; now.HomeTime(); TDateTime dateTime; dateTime = now.DateTime(); timeStamp.Format( KLogTimeFormat, dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond() ); buf.Insert( 0, timeStamp ); logger.Write(buf); } logger.Close(); VA_END( args ); #else RDebug::Print(aText); #endif }
void CMgAppUi::DoExitChecksNowL(void) { if(!IsDrawerOn()) { CApaCommandLine* cmdLine=CApaCommandLine::NewLC(); cmdLine->SetCommandL(EApaCommandRun); cmdLine->SetExecutableNameL(KtxServerFileName); RApaLsSession ls; ls.Connect(); ls.StartApp(*cmdLine); ls.Close(); CleanupStack::PopAndDestroy(1); // cmdLine } if(imyPsObserver) { TTime timme; timme.HomeTime(); imyPsObserver->SetPropertyL(timme.DateTime().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); } }
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 } }
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() ); }
// ---------------------------------------------------- // 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; } } }
// --------------------------------------------------------------------------- // CWlanBgScan::TimeRelationToRange // --------------------------------------------------------------------------- // CWlanBgScan::TRelation CWlanBgScan::TimeRelationToRange( const TTime& aTime, TUint aRangeStart, TUint aRangeEnd ) const { #ifdef _DEBUG TBuf<KWlanBgScanMaxDateTimeStrLen> dbgString; TRAP_IGNORE( aTime.FormatL( dbgString, KWlanBgScanDateTimeFormat2 ) ); DEBUG1( "CWlanBgScan::TimeRelationToRange() - time: %S", &dbgString ); #endif TDateTime dateTime( aTime.DateTime() ); TUint timeToCheck = ( dateTime.Hour() * KGetHours ) + dateTime.Minute(); DEBUG2( "CWlanBgScan::TimeRelationToRange() - range: %04u - %04u", aRangeStart, aRangeEnd ); CWlanBgScan::TRelation relation( ESmaller ); if( aRangeStart == aRangeEnd ) { DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" ); relation = EGreater; } else if( aRangeStart > aRangeEnd ) { DEBUG( "CWlanBgScan::TimeRelationToRange() - range crosses the midnight" ); /** * As range crosses midnight, there is no way for the relation to be ESmaller. */ if( timeToCheck < aRangeEnd || timeToCheck >= aRangeStart ) { DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EInsideRange" ); relation = EInsideRange; } else { DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" ); relation = EGreater; } } else { if( timeToCheck < aRangeStart ) { DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: ESmaller" ); relation = ESmaller; } else if( timeToCheck >= aRangeStart && timeToCheck < aRangeEnd ) { DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EInsideRange" ); relation = EInsideRange; } else { DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" ); relation = EGreater; } } return relation; }
// --------------------------------------------------------------------------- // TPresCondValidity::ParseFromXMLTimeString() // --------------------------------------------------------------------------- // TInt TPresCondValidity::ParseFromXMLTimeString(const TDesC& aXMLTimeString, TTime& aUTCDateTime) { OPENG_DP(D_OPENG_LIT( " TPresCondValidity::ParseFromXMLTimeString()" ) ); OPENG_DP(D_OPENG_LIT( " ParseFromXMLTimeString aXMLTimeString = %S"), &aXMLTimeString); TInt err(KErrNone); // Initializing the locale TLocale myLocale, systemLocale; myLocale.Refresh(); systemLocale.Refresh(); myLocale.SetDateFormat(EDateJapanese); myLocale.SetDateSeparator('-',1); myLocale.SetDateSeparator('-',2); myLocale.SetDateSeparator('T',3); myLocale.SetTimeFormat(ETime24); myLocale.SetTimeSeparator(':',1); myLocale.SetTimeSeparator(':',2); myLocale.SetTimeSeparator(' ',3); myLocale.Set(); TTime myTime; TTime myUTCtime; TChar uTCtimeSign(aXMLTimeString[23]); // 23 is ascii T // parsing main time TBuf<KPresDateTimeBufLength> dateTimeBuffer(aXMLTimeString); dateTimeBuffer.Delete(KPresDTWithoutUTCLength-1,6); dateTimeBuffer.Replace(KPresDTSeperatorPos,1,KPresSpaceString); myTime.Parse(dateTimeBuffer); // parsing utc time TBuf<KPresDateTimeBufLength> uTCbuffer(aXMLTimeString); uTCbuffer.Delete(0,KPresDTWithoutUTCLength); myUTCtime.Parse(uTCbuffer); TDateTime uTCDateTime = myUTCtime.DateTime(); // adding or substracting utc from main time if(uTCtimeSign=='+') // if diff is positive { aUTCDateTime = myTime - TTimeIntervalHours(uTCDateTime.Hour()); aUTCDateTime = aUTCDateTime - TTimeIntervalMinutes(uTCDateTime.Minute()); } else if(uTCtimeSign=='-') { aUTCDateTime = myTime + TTimeIntervalHours(uTCDateTime.Hour()); aUTCDateTime = aUTCDateTime + TTimeIntervalMinutes(uTCDateTime.Minute()); } else err = KErrArgument; // putting the system locale back systemLocale.Set(); return err; }
EXPORT_C TBool StartsAt(const TMsvOffPeakTime& time1, const TTime& time2) { TDateTime dateTime2 = time2.DateTime(); if(time1.Day() != time2.DayNoInWeek()) return EFalse; if(time1.Hour() != dateTime2.Hour()) return EFalse; if(time1.Minute() != dateTime2.Minute()) return EFalse; return ETrue; }
// ---------------------------------------------------------------------------- // convertDateTime() // ---------------------------------------------------------------------------- // void convertDateTime(const TTime& aFromTime, QDateTime& aToDateTime) { const TDateTime &symbianDateTime = aFromTime.DateTime(); QDate date(symbianDateTime.Year(), symbianDateTime.Month()+1, symbianDateTime.Day()+1); QTime time(symbianDateTime.Hour(), symbianDateTime.Minute(), symbianDateTime.Second()); aToDateTime.setDate(date); aToDateTime.setTime(time); }
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); }
CTzRules* CTzUserDataTest::CreateUserDefinedTzLC(TInt16 aStandardOffset,TInt16 aDSTOffset) { TTime dston (TDateTime(2005, EMarch, 0, 0, 0, 0, 0)); TTime dstoff (TDateTime(2005, ESeptember, 0, 0, 0, 0, 0)); TMonth monthOn = dston.DateTime().Month(); TInt dayOn = dston.DateTime().Day(); TMonth monthOff = dstoff.DateTime().Month(); TInt dayOff = dstoff.DateTime().Day(); TTzRule dstOff(0, 9999, aStandardOffset, aDSTOffset, monthOn, ETzFixedDate, dayOn, 0, ETzWallTimeReference, 120); TTzRule dstOn (0, 9999, aDSTOffset, aStandardOffset, monthOff, ETzFixedDate, dayOff, 0, ETzWallTimeReference, 120); CTzRules* rules = CTzRules::NewL(0, 9999); CleanupStack::PushL(rules); rules->AddRuleL(dstOff); rules->AddRuleL(dstOn); return rules; }
void RTestExecuteLogServ::AddTime(TDes8& aLogBuffer) { TTime now; now.UniversalTime(); TDateTime dateTime = now.DateTime(); _LIT8(KFormat,"%02d:%02d:%02d:%03d "); // add the current time aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000)); }
void CSerialWriter::AddTime(TDes8& aLogBuffer) { TTime now; now.UniversalTime(); TDateTime dateTime = now.DateTime(); _LIT8(KFormat,"%02d:%02d:%02d:%03d "); // add the current time aLogBuffer.Append(KTEFNewLine) ; aLogBuffer.AppendFormat(KFormat,dateTime.Hour(),dateTime.Minute(),dateTime.Second(),(dateTime.MicroSecond()/1000)); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CFakeSMSSender::ConstructL() { User::LeaveIfError(iFsSession.Connect()); // iFsSession.Delete(KRecFilename); // iFile.Create(iFsSession,KRecFilename,EFileWrite|EFileShareAny); if(iFile.SubSessionHandle()) { TTime CurrTime; CurrTime.HomeTime(); TBuf8<200> MsgBuffer(_L8("Started: ")); MsgBuffer.AppendNum(CurrTime.DateTime().Day()); TInt MyMonth = (CurrTime.DateTime().Month() + 1); MsgBuffer.Append(_L(".")); if(MyMonth < 10) MsgBuffer.AppendNum(0); MsgBuffer.AppendNum(MyMonth); MsgBuffer.Append(_L(".")); MsgBuffer.AppendNum(CurrTime.DateTime().Year()); MsgBuffer.Append(_L(" - ")); MsgBuffer.AppendNum(CurrTime.DateTime().Hour()); MsgBuffer.Append(_L(":")); if(CurrTime.DateTime().Minute() < 10) MsgBuffer.AppendNum(0); MsgBuffer.AppendNum(CurrTime.DateTime().Minute()); MsgBuffer.Append(_L(".")); if(CurrTime.DateTime().Second() < 10) MsgBuffer.AppendNum(0); MsgBuffer.AppendNum(CurrTime.DateTime().Second()); MsgBuffer.Append(_L("\n")); iFile.Write(MsgBuffer); } //iMsvSession = CMsvSession::OpenAsyncL(*this); iMsvSession = CMsvSession::OpenSyncL(*this); iMtmReg = CClientMtmRegistry::NewL(*iMsvSession); }
void CSheduleServerLog::WriteWithTimeStamp(const TDesC& aText) { TBuf<200> buf; TTime now; now.HomeTime(); TDateTime dateTime; dateTime = now.DateTime(); buf.Format(_L("%02d.%02d:%02d:%06d "), dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond()); Write(buf); Write(aText); }
void CRuleManager::TimeFormat(const TTime& aTime,TDes8& aDes) { TDateTime time = aTime.DateTime(); TInt hour,minute; hour = time.Hour() ; minute = time.Minute() ; aDes.AppendNum(hour); aDes.Append(':'); aDes.AppendNum(minute); }
void CTe_RegConcurrentTestStepBase::PrintCurrentTimeStamp(TBool aStart) { TTime time; time.UniversalTime(); TDateTime dateTime = time.DateTime(); TBuf<32> timeBuf; timeBuf.Format(_L("%02d:%02d:%02d:%03d"), dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond()); TBuf<16> buf(aStart?_L("started"):_L("ended")); _LIT(KTimeFormat, "%S in server %S %S at %S"); INFO_PRINTF5(KTimeFormat, &ConfigSection(), &GetServerName(), &buf, &timeBuf); }
// ----------------------------------------------------------------------------- // CUpdateManager::StartTimer // // Start timer. // ----------------------------------------------------------------------------- // void CUpdateManager::StartTimer() { TTime time; time.HomeTime(); TDateTime dateTime = time.DateTime(); iMins = dateTime.Hour() * 60 + dateTime.Minute(); TTimeIntervalMinutes interval(KMinFrequency - iMins % KMinFrequency); time += interval; At(time); }
// --------------------------------------------------------------------------- // TPresCondValidity::FormatToXMLTimeStringL() // --------------------------------------------------------------------------- // TInt TPresCondValidity::FormatToXMLTimeStringL(TDes& aXMLTimeString, const TTime aUTCDateTime) { OPENG_DP(D_OPENG_LIT( " TPresCondValidity::FormatToXMLTimeString()" ) ); OPENG_DP(D_OPENG_LIT( " FormatToXMLTimeString aUTCDateTime:")); LogDateTime(aUTCDateTime.DateTime()); // Initializing the locale TLocale myLocale, systemLocale; myLocale.Refresh(); systemLocale.Refresh(); myLocale.SetDateFormat(EDateJapanese); myLocale.SetDateSeparator('-',1); myLocale.SetDateSeparator('-',2); myLocale.SetDateSeparator('T',3); myLocale.SetTimeFormat(ETime24); myLocale.SetTimeSeparator(':',1); myLocale.SetTimeSeparator(':',2); myLocale.SetTimeSeparator(' ',3); myLocale.Set(); // getting UTC difference TTimeIntervalSeconds uTCseconds = systemLocale.UniversalTimeOffset(); // processing main time and date component TTime mainTTime = aUTCDateTime + uTCseconds; mainTTime.FormatL(aXMLTimeString, KPresDateTimeFormatString); // Processing for time difference TChar uTCtimeSign('+'); TDateTime myUTCtime(0,EJanuary,0,0,0,0,0); TTime uTCTTime(myUTCtime); if(uTCseconds.Int()<0) { uTCtimeSign = '-'; uTCseconds = (uTCseconds.Int())*(-1); } uTCTTime = uTCTTime + uTCseconds; TBuf<KPresDateTimeBufLength> dateTimeUTCBuffer; uTCTTime.FormatL(dateTimeUTCBuffer, KPresUTCFormatString); // Appending the time difference to main string aXMLTimeString.Append(dateTimeUTCBuffer); // put time difference sign to main string aXMLTimeString[23] = uTCtimeSign; // putting the system locale back systemLocale.Set(); return KErrNone; }
EXPORT_C void CMsvScheduleSend::RoundUpToMinute(TTime& aTime) { TDateTime dt(aTime.DateTime()); if (dt.MicroSecond() != 0 || dt.Second() != 0) { dt.SetMicroSecond(0); dt.SetSecond(0); aTime = dt; aTime += (TTimeIntervalMinutes) 1; } }