/* ================================ F_DumpGlobalMemoryStats ================================ */ void F_DumpGlobalMemoryStats( mxOutputDevice& log ) { CalendarTime localTime( CalendarTime::GetCurrentLocalTime() ); StackString timeOfDay; GetTimeOfDayString( timeOfDay, localTime.hour, localTime.minute, localTime.second ); log.Logf( LL_Info, "\n\n[%s] Memory heap stats:\n", timeOfDay.ToChars() ); mxMemoryStatistics totalStats; for( UINT iMemHeap = 0; iMemHeap < EMemHeap::HeapCount; iMemHeap++ ) { const mxMemoryStatistics& heapStats = g_memStats[ iMemHeap ]; log.Logf( LL_Info, "\n\n--- [%u] Memory heap: '%s' ----------", iMemHeap, mxGetMemoryHeapName( (EMemHeap)iMemHeap ) ); WriteMemHeapStats( heapStats, log ); totalStats.bytesAllocated += heapStats.bytesAllocated; totalStats.totalAllocated += heapStats.totalAllocated; totalStats.totalNbAllocations += heapStats.totalNbAllocations; totalStats.peakMemoryUsage += heapStats.peakMemoryUsage; totalStats.totalNbReallocations += heapStats.totalNbReallocations; totalStats.totalFreed += heapStats.totalFreed; totalStats.totalNbDeallocations += heapStats.totalNbDeallocations; } log.Logf( LL_Info, "\n--- Total ----------\n" ); WriteMemHeapStats( totalStats, log ); }
int ONVIF::SystemDateAndTime::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 6) qt_static_metacall(this, _c, _id, _a); _id -= 6; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 6) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 6; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< DateTimeType*>(_v) = dateTimeType(); break; case 1: *reinterpret_cast< bool*>(_v) = daylightSavings(); break; case 2: *reinterpret_cast< QString*>(_v) = tz(); break; case 3: *reinterpret_cast< QDateTime*>(_v) = utcTime(); break; case 4: *reinterpret_cast< QDateTime*>(_v) = localTime(); break; case 5: *reinterpret_cast< bool*>(_v) = result(); break; default: break; } _id -= 6; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setDateTimeType(*reinterpret_cast< DateTimeType*>(_v)); break; case 1: setDaylightSavings(*reinterpret_cast< bool*>(_v)); break; case 2: setTz(*reinterpret_cast< QString*>(_v)); break; case 3: setutcTime(*reinterpret_cast< QDateTime*>(_v)); break; case 4: setlocalTime(*reinterpret_cast< QDateTime*>(_v)); break; case 5: setResult(*reinterpret_cast< bool*>(_v)); break; default: break; } _id -= 6; } else if (_c == QMetaObject::ResetProperty) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 6; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 6; } else if (_c == QMetaObject::RegisterPropertyMetaType) { if (_id < 6) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 6; } #endif // QT_NO_PROPERTIES return _id; }
void tst_storage::tst_timezone() { // for test sanity, verify kdatetime actually agrees timezone is for helsinki. // TZ environment variable and such normal methods are, of course, not supported. // in case this fails, might want to write Europe/Helsinki to /etc/timezone KDateTime localTime(QDate(2014, 1, 1)); qDebug() << "local time offset:" << localTime.utcOffset(); QCOMPARE(localTime.utcOffset(), 7200); }
//********************************************************************************** // //********************************************************************************** void CBackground::Open() { CRenderable::Register( CRenderable::RO_BACKGROUND, Render ); for ( u32 i = 0; i < NUM_STRIPS; ++i ) { s_StripInfo[ i ].m_SinPos += ( rand() % 2000 ) / 1000.f; } time_t localTime( time( NULL ) ); struct tm * p_calendar_time( gmtime( &localTime ) ); SetBackgroundImage( p_calendar_time->tm_mon + 1 ); }
void tst_storage::tst_origintimes() { SqliteStorage *ss = dynamic_cast<SqliteStorage*>(m_storage.data()); QVERIFY(ss); KDateTime utcTime(QDate(2014, 1, 15), QTime(), KDateTime::UTC); KDateTime clockTime(QDate(2014, 1, 15), QTime(), KDateTime::ClockTime); KDateTime localTime(QDate(2014, 1, 15), QTime(), KDateTime::LocalZone); // local origin time is the same as specific time set to utc // note: currently origin time of clock time is saved as time in current time zone. // that does not necessarily make sense, but better be careful when changing behavior there. QCOMPARE(ss->toOriginTime(utcTime), ss->toLocalOriginTime(utcTime)); QCOMPARE(ss->toLocalOriginTime(clockTime), ss->toLocalOriginTime(utcTime)); QCOMPARE(ss->toLocalOriginTime(localTime), ss->toLocalOriginTime(utcTime)); }
wrBuffer GetCurrentDateTimeString() { wrBuffer currentDateTime; CalendarTime localTime( CalendarTime::GetCurrentLocalTime() ); String timeOfDay; GetTimeOfDayString( localTime.hour, localTime.minute, localTime.second, timeOfDay ); currentDateTime.Format( "on %s, %s %u%s, at %s", CalendarTime::WeekdayToStr( localTime.weekday ), CalendarTime::MonthToStr( localTime.month ), localTime.day, GetNumberExtension( localTime.day ), timeOfDay.ToChars() ); return currentDateTime; }
// input is UTC void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, GregorianDateTime& tm) { LocalTimeOffset localTime(false, 0); if (!outputIsUTC) { localTime = localTimeOffset(exec, ms); ms += localTime.offset; } const int year = msToYear(ms); tm.second = msToSeconds(ms); tm.minute = msToMinutes(ms); tm.hour = msToHours(ms); tm.weekDay = msToWeekDay(ms); tm.yearDay = dayInYear(ms, year); tm.monthDay = dayInMonthFromDayInYear(tm.yearDay, isLeapYear(year)); tm.month = monthFromDayInYear(tm.yearDay, isLeapYear(year)); tm.year = year - 1900; tm.isDST = localTime.isDST; tm.utcOffset = localTime.offset / WTF::msPerSecond; tm.timeZone = NULL; }
bool CityWeather::isDayTime( const YawpDay * day ) const { if( !day || !day->sunset().isValid() || !day->sunrise().isValid() ) return true; QDateTime currentTime; if( observationPeriode().isValid() ) currentTime = observationPeriode(); else currentTime = localTime(); QDateTime sunrise( currentTime.date(), day->sunrise() ); QDateTime sunset( currentTime.date(), day->sunset() ); bool bReturn = (currentTime > sunrise && currentTime < sunset); dTracing() << "City: " << m_sLocalizedCity <<" current Time:" << currentTime << " sunrise:" << sunrise << " sunset:" << sunset << " daytime:" << bReturn; return bReturn; }
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()); }
TInt CUnknownZoneTest::CreateAndRunTestUnitL() { User::LeaveIfError(iTimeZoneServer.Connect()); // // Initially set home zone to London // CTzId* tzId = CTzId::NewL(_L8("Europe/London")); CleanupStack::PushL(tzId); iTimeZoneServer.SetTimeZoneL(*tzId); // // Call SetUnknownZoneTime. Set the time to a winter time in Europe/London // to check that the previous time zone settings are overridden by the new // unknown zone settings. // TDateTime winterDateTime(2006,EJanuary,10,10,0,0,0); // 11-Jan-2006 10:00 TTime localTime(winterDateTime); localTime.HomeTime(); TInt offset = 120; // UTC+2 iTimeZoneServer.SetUnknownZoneTimeL(localTime,offset); TTime utcTime(localTime); iTimeZoneServer.ConvertToUniversalTime(utcTime); TTimeIntervalMinutes diff; localTime.MinutesFrom(utcTime,diff); if (diff.Int() != offset) { ERR_PRINTF3(_L("Expected offset = %D, Retrieved offset = %D"),&offset,&diff); return KErrGeneral; } // convert back to local time and we should get the initial time again iTimeZoneServer.ConvertToLocalTime(utcTime); if (utcTime!=localTime) { ERR_PRINTF1(_L("ConvertToLocalTime failed")); return KErrGeneral; } // // Repeat again with a London summer time // // reset time zone to London iTimeZoneServer.SetTimeZoneL(*tzId); TDateTime summerDateTime(2006,EJune,10,10,0,0,0); // 11-June-2006 10:00 localTime = summerDateTime; localTime.HomeTime(); iTimeZoneServer.SetUnknownZoneTimeL(localTime,offset); utcTime = localTime; iTimeZoneServer.ConvertToUniversalTime(utcTime); localTime.MinutesFrom(utcTime,diff); if (diff.Int() != offset) { ERR_PRINTF3(_L("Expected offset = %D, Retrieved offset = %D"),&offset,&diff); return KErrGeneral; } // convert back to local time and we should get the initial time again iTimeZoneServer.ConvertToLocalTime(utcTime); if (utcTime!=localTime) { ERR_PRINTF1(_L("ConvertToLocalTime failed")); return KErrGeneral; } CleanupStack::PopAndDestroy(tzId); return KErrNone; }