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())); }
// --------------------------------------------------------------------------- // 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() ); }
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 }
CIpuTestHarness::~CIpuTestHarness() // // D'tor { TTime endtime; endtime.UniversalTime(); // Do resource handle leak test? if (iDoResourceLeakTest) ResourceLeakTest(); // End of tests - see if failed or ok if (iFailedTests->Count()) { TestHarnessFailed(); } else { TestHarnessComplete(); } iFailedTests->ResetAndDestroy(); delete iFailedTests; // Log finish time TDateTime t = endtime.DateTime(); LogIt(_L("Ended @ %d:%d:%d:%d"),t.Hour(),t.Minute(),t.Second(),t.MicroSecond()); TTime difftime(endtime.Int64() - iStartTime.Int64()); t = difftime.DateTime(); LogIt(_L("Execution time %d:%d:%d:%d"),t.Hour(),t.Minute(),t.Second(),t.MicroSecond()); // Close logs and test harness iFlogger.CloseLog(); // iTest test harness performs UHEAP MARK/UNMARK check upon creation/destruction // therefore, it must be destroyed last since it is created first in // CIpuTestHarness iTest.Close(); }
void CIpuTestHarness::ConstructL(const TDesC& aTitle) // // Non-trivial c'tor { // Create iFailedTests iFailedTests = new (ELeave) CArrayPtrFlat<CTestInfo> (KFailedTestsGranularity); // Start up logging server connection TBuf<64> temp(aTitle); DefaultLogFileName(temp); CreateFlogger(temp, EFalse, EFalse); iStartTime.UniversalTime(); TDateTime t = iStartTime.DateTime(); LogIt(_L("Started @ %d:%d:%d:%d"),t.Hour(),t.Minute(),t.Second(),t.MicroSecond()); // Find number of open resource handles TInt processHandleCount=0; RThread().HandleCount(processHandleCount,iStartHandleCount); }
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); }
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)); }
// 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()); }
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); }
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(); } }
void eap_am_type_securid_symbian_c::store_authentication_timeL() { EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, ( EAPL("eap_am_type_securid_symbian_c::store_authentication_timeL: EAP-tunneling type=0xfe%06x%08x\n"), m_tunneling_type.get_vendor_id(), m_tunneling_type.get_vendor_type())); HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); TPtr sqlStatement = buf->Des(); // Query all the relevant parameters _LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); if (m_eap_type == eap_type_generic_token_card) { sqlStatement.Format( KSQLQuery, &KGTCLastFullAuthTime, &KGtcTableName, &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingTypeVendorId, m_tunneling_type.get_vendor_id(), &KTunnelingType, m_tunneling_type.get_vendor_type()); } else { // Secure ID is not supported at the moment. // Leave with error. CleanupStack::PopAndDestroy(buf); // Delete buf. User::Leave(KErrNotSupported); } RDbView view; // Evaluate view User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); CleanupClosePushL(view); User::LeaveIfError(view.EvaluateAll()); // Get the first (and only) row for updation. view.FirstL(); view.UpdateL(); // Get column set so we get the correct column numbers CDbColSet* colSet = view.ColSetL(); CleanupStack::PushL(colSet); // Get the current universal time. TTime currentTime; currentTime.UniversalTime(); #if defined(_DEBUG) || defined(DEBUG) TDateTime currentDateTime = currentTime.DateTime(); EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::store_authentication_time, %2d-%2d-%4d : %2d-%2d-%2d-%d\n"), currentDateTime.Day()+1, currentDateTime.Month()+1,currentDateTime.Year(), currentDateTime.Hour(), currentDateTime.Minute(), currentDateTime.Second(), currentDateTime.MicroSecond())); #endif TInt64 fullAuthTime = currentTime.Int64(); view.SetColL(colSet->ColNo(KGTCLastFullAuthTime), fullAuthTime); view.PutL(); CleanupStack::PopAndDestroy(colSet); // Delete colSet. CleanupStack::PopAndDestroy(&view); // Close view. CleanupStack::PopAndDestroy(buf); // Delete buf. EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); }
TVerdict CAppFwkStartSafeTestStepProcMonSysRestart::doTestStepL() { #ifdef __WINSCW__ ASSERT(0); #endif CActiveScheduler* sched = new(ELeave) CActiveScheduler; CleanupStack::PushL(sched); CActiveScheduler::Install(sched); iNotifier = CSaveNotifier::NewL(*this); CStartSafe* startSafe = CStartSafe::NewL(); CleanupStack::PushL( startSafe ); CStartupProperties* prop = CStartupProperties::NewLC(); prop->SetFileParamsL(KTestProcGood, KNullDesC); prop->SetStartMethod(EWaitForStart); prop->SetMonitored(ETrue); prop->SetRecoveryParams(ERestartOS, 0); TInt tried; RProcess proc; CleanupClosePushL(proc); TRAPD(err, startSafe->StartAndMonitorL(*prop, proc, tried)); TEST(KErrNone == err); CleanupStack::Pop(&proc); CleanupStack::PopAndDestroy(prop); CleanupStack::PopAndDestroy(startSafe); INFO_PRINTF1(_L("Process monitoring setup with TRecoveryMethod=ERestartOS")); proc.Kill(KErrNone); proc.Close(); TTime init; init.UniversalTime(); INFO_PRINTF4( _L("Process killed at time %d:%d.%d"), init.DateTime().Minute(), init.DateTime().Second(), init.DateTime().MicroSecond()); INFO_PRINTF1(_L("Starting scheduler (expecting an OS restart)")); CActiveScheduler::Start(); //Wait for MSaveObserver callback //resume here after callback has stopped the scheduler TESTE(iCallbackReceived, iCallbackReceived); if(iCallbackReceived) { const TTimeIntervalMicroSeconds elapsedTime = iShutdownPerformed.MicroSecondsFrom(init); const TDateTime dt = iShutdownPerformed.DateTime(); const TInt64 value = elapsedTime.Int64(); INFO_PRINTF5(_L("Shutdown callback received at time %d:%d.%d (after %d microseconds)"), dt.Minute(), dt.Second(), dt.MicroSecond(), value); TESTE((value >= 0) && (value < 1000000), value); // within 1 second } else { INFO_PRINTF1( _L("Restart didn't take place :-(")); TEST(EFalse); } // Now call CPowerdownClient::QueryServerPowerState() which will in turn call the method 'ServerPowerState()' // to stop the shutdown. This function call will cause the shutdown server in syslibs/pwrcli to cancel power off. INFO_PRINTF1(_L("Aborting shutdown.")); TBool powerOff = EFalse; CPowerdownClient* powerdownclient = CPowerdownClient::NewL(); CleanupStack::PushL(powerdownclient); TEST(KErrNone == powerdownclient->QueryServerPowerState(iNotifier,powerOff)); TEST(powerOff); CleanupStack::PopAndDestroy(powerdownclient); CleanupStack::PopAndDestroy(sched); return TestStepResult(); }
void PsyUtils::TPositionInfo2QGeoPositionInfo(TPositionInfoBase &aPosInfoBase, QGeoPositionInfo& aQPosInfo) { if (aPosInfoBase.PositionClassType() & EPositionInfoClass || aPosInfoBase.PositionClassType() & EPositionSatelliteInfoClass) { TPositionInfo *posInfo = static_cast<TPositionInfo*>(&aPosInfoBase); TPosition pos; QGeoCoordinate coord; posInfo->GetPosition(pos); coord.setLatitude(pos.Latitude()); coord.setLongitude(pos.Longitude()); coord.setAltitude(pos.Altitude()); //store the QGeoCoordinate values aQPosInfo.setCoordinate(coord); TDateTime datetime = pos.Time().DateTime(); QDateTime dt(QDate(datetime.Year() , datetime.Month() + 1, datetime.Day() + 1), QTime(datetime.Hour() , datetime.Minute(), datetime.Second(), datetime.MicroSecond() / 1000), Qt::UTC); //store the time stamp aQPosInfo.setTimestamp(dt); //store the horizontal accuracy aQPosInfo.setAttribute(QGeoPositionInfo::HorizontalAccuracy, pos.HorizontalAccuracy()); //store the vertical accuracy aQPosInfo.setAttribute(QGeoPositionInfo::VerticalAccuracy, pos.VerticalAccuracy()); if (aPosInfoBase.PositionClassType() & EPositionSatelliteInfoClass) { TCourse course; TPositionSatelliteInfo *satInfo = static_cast<TPositionSatelliteInfo*>(&aPosInfoBase); satInfo->GetCourse(course); aQPosInfo.setAttribute(QGeoPositionInfo::Direction, course.Heading()); aQPosInfo.setAttribute(QGeoPositionInfo::GroundSpeed, course.Speed()); aQPosInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, course.VerticalSpeed()); } } if (aPosInfoBase.PositionClassType() & EPositionGenericInfoClass) { HPositionGenericInfo *genInfo = static_cast<HPositionGenericInfo*>(&aPosInfoBase); float val; //check for the horizontal speed if (genInfo->IsFieldAvailable(EPositionFieldHorizontalSpeed)) { genInfo->GetValue(EPositionFieldHorizontalSpeed, val); aQPosInfo.setAttribute(QGeoPositionInfo::GroundSpeed, val); } //check for the vertcal speed if (genInfo->IsFieldAvailable(EPositionFieldVerticalSpeed)) { genInfo->GetValue(EPositionFieldVerticalSpeed, val); aQPosInfo.setAttribute(QGeoPositionInfo::VerticalSpeed, val); } //check for the magnetic variation if (genInfo->IsFieldAvailable(EPositionFieldMagneticCourseError)) { genInfo->GetValue(EPositionFieldMagneticCourseError, val); aQPosInfo.setAttribute(QGeoPositionInfo::MagneticVariation, val); } //check for the heading if (genInfo->IsFieldAvailable(EPositionFieldHeading)) { genInfo->GetValue(EPositionFieldHeading, val); aQPosInfo.setAttribute(QGeoPositionInfo::Direction, val); } } }
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)); }
LOCAL_C void TestReportLog(const TDesC8& aText) { TBuf8<200> buf; TTime now; now.UniversalTime(); TDateTime dateTime; dateTime = now.DateTime(); buf.Format(_L8 ("%02d.%02d:%02d:%06d "),dateTime.Hour(),dateTime.Minute(),dateTime.Second(),dateTime.MicroSecond()); buf.AppendFormat(_L8("%S\015\012"),&aText); TestRpt.Write(buf); TestRpt.Flush(); }
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); }
bool eap_am_type_securid_symbian_c::is_session_validL() { EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); EAP_TRACE_DEBUG( m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::is_session_valid(): EAP-tunneling type=0xfe%06x%08x\n"), m_tunneling_type.get_vendor_id(), m_tunneling_type.get_vendor_type())); HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength); TPtr sqlStatement = buf->Des(); // Query all the relevant parameters _LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d"); if (m_eap_type == eap_type_generic_token_card) { sqlStatement.Format( KSQLQuery, &cf_str_EAP_GTC_max_session_validity_time_literal, &KGTCLastFullAuthTime, &KGtcTableName, &KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingTypeVendorId, m_tunneling_type.get_vendor_id(), &KTunnelingType, m_tunneling_type.get_vendor_type()); } else { // Secure ID is not supported at the moment. // Treat this as session invalid. CleanupStack::PopAndDestroy(buf); // Delete buf. return false; } RDbView view; // Evaluate view User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited)); CleanupClosePushL(view); User::LeaveIfError(view.EvaluateAll()); // Get the first (and only) row view.FirstL(); view.GetL(); // Get column set so we get the correct column numbers CDbColSet* colSet = view.ColSetL(); CleanupStack::PushL(colSet); TInt64 maxSessionTime = view.ColInt64(colSet->ColNo(cf_str_EAP_GTC_max_session_validity_time_literal)); TInt64 fullAuthTime = view.ColInt64(colSet->ColNo(KGTCLastFullAuthTime)); CleanupStack::PopAndDestroy(colSet); // Delete colSet. CleanupStack::PopAndDestroy(&view); // Close view. CleanupStack::PopAndDestroy(buf); // Delete buf. // If the max session time from DB is zero then we use the // one read from configuration file. if( maxSessionTime == 0) { EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, ( EAPL("Session Validity - Using max session validity time from config file\n"))); maxSessionTime = m_max_session_time; // value from configuration file. } // Get the current time. TTime currentTime; currentTime.UniversalTime(); TTime lastFullAuthTime(fullAuthTime); #if defined(_DEBUG) || defined(DEBUG) TDateTime currentDateTime = currentTime.DateTime(); TDateTime fullAuthDateTime = lastFullAuthTime.DateTime(); EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Session Validity - Current Time, %2d-%2d-%4d : %2d-%2d-%2d-%d\n"), currentDateTime.Day()+1, currentDateTime.Month()+1, currentDateTime.Year(), currentDateTime.Hour(), currentDateTime.Minute(), currentDateTime.Second(), currentDateTime.MicroSecond())); EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Session Validity - Last Full Auth Time, %2d-%2d-%4d : %2d-%2d-%2d-%d\n"), fullAuthDateTime.Day()+1, fullAuthDateTime.Month()+1, fullAuthDateTime.Year(), fullAuthDateTime.Hour(), fullAuthDateTime.Minute(), fullAuthDateTime.Second(), fullAuthDateTime.MicroSecond())); #endif TTimeIntervalMicroSeconds interval = currentTime.MicroSecondsFrom(lastFullAuthTime); EAP_TRACE_DATA_DEBUG( m_am_tools, TRACE_FLAGS_DEFAULT,(EAPL("eap_am_type_securid_symbian_c::is_session_valid:interval in microseconds:"), &(interval.Int64()), sizeof(interval.Int64()) ) ); EAP_TRACE_DATA_DEBUG( m_am_tools, TRACE_FLAGS_DEFAULT,(EAPL("eap_am_type_securid_symbian_c::is_session_valid:max session time in microseconds:"), &(maxSessionTime), sizeof(maxSessionTime) ) ); #if defined(_DEBUG) || defined(DEBUG) TTimeIntervalMinutes intervalMins; TInt error = currentTime.MinutesFrom(lastFullAuthTime, intervalMins); if(error == KErrNone) { EAP_TRACE_DEBUG( m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::is_session_validL()") EAPL("interval in Minutes =%d\n"), intervalMins.Int())); } #endif if( maxSessionTime >= interval.Int64() ) { EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::is_session_valid - Session Valid \n"))); EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); return true; } else { EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("eap_am_type_securid_symbian_c::is_session_valid - Session NOT Valid \n"))); EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); return false; } }