本文整理汇总了C++中TDateTime类的典型用法代码示例。如果您正苦于以下问题:C++ TDateTime类的具体用法?C++ TDateTime怎么用?C++ TDateTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TDateTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FLOG
void CFMSServer::DeleteScheduledRemindersL()
{
FLOG(_L("CFMSServer::DeleteScheduledRemindersL >>"));
TScheduleEntryInfo2 ret;
TInt err;
RScheduler sc;
TTime t;
TTsTime time;
TSchedulerItemRef scitem;
CArrayFixFlat<TSchedulerItemRef>* aSchRefArray = new CArrayFixFlat <TSchedulerItemRef>(5);
TScheduleFilter aFilter(EAllSchedules);
User::LeaveIfError( sc.Connect() );
CleanupClosePushL( sc );
CleanupStack::PushL(aSchRefArray);
User::LeaveIfError( sc.GetScheduleRefsL( *aSchRefArray,aFilter) );
FLOG(_L("Schedule items: "));
for ( TInt i=0; i<aSchRefArray->Count(); ++i )
{
TSchedulerItemRef it = (*aSchRefArray)[i];
if ( it.iName == TUid::Uid(KFMSServerUid).Name() )
{
TScheduleState2 sc_state;
CArrayFixFlat<TScheduleEntryInfo2>* sc_entries = new CArrayFixFlat <TScheduleEntryInfo2>(5);
CArrayFixFlat<TTaskInfo>* sc_tasks = new CArrayFixFlat <TTaskInfo>(5);
TTsTime sc_duetime;
CleanupStack::PushL( sc_entries );
CleanupStack::PushL( sc_tasks );
FLOG (_L("%d. schedule handle: %d name:'%S'"),i,it.iHandle, &(it.iName) );
err = sc.GetScheduleL ( it.iHandle , sc_state, *sc_entries,*sc_tasks,sc_duetime ); // xx
TDateTime dtm = sc_duetime.GetLocalTime().DateTime();
FLOG(_L(" schedule duetime:%d:%d"), dtm.Hour(), dtm.Minute());
if ( err ) FLOG(_L(" schedule sc get err %d"),err);
else
{
for ( TInt k=0; k<sc_entries->Count();++k)
{
TScheduleEntryInfo2 sc_entry = (*sc_entries)[k];
ret = sc_entry;
TTime sctime = sc_entry.StartTime().GetLocalTime();
FLOG(_L(" schedule entry %d int-type:%d int:%d start: %d:%d"),k,sc_entry.IntervalType(),sc_entry.Interval(),sctime.DateTime().Hour(),sctime.DateTime().Minute());
}
for ( TInt j=0; j<sc_tasks->Count();++j)
{
TTaskInfo sc_task = (*sc_tasks)[j];
FLOG(_L(" schedule task %d '%S'"),sc_task.iTaskId,&(sc_task.iName) );
if ( sc_task.iName==TUid::Uid(KFMSServerUid).Name() )
{
FLOG(_L(" schedule DeleteTask %d"),sc_task.iTaskId);
User::LeaveIfError( sc.DeleteTask(sc_task.iTaskId) );
}
}
}
FLOG(_L(" DeleteSchedule %d"),it.iHandle);
err = sc.DeleteSchedule(it.iHandle );
FLOG(_L("Delete status of tasks = %d"), err);
CleanupStack::PopAndDestroy( sc_tasks );
CleanupStack::PopAndDestroy( sc_entries );
}
}
CleanupStack::PopAndDestroy( aSchRefArray );
CleanupStack::PopAndDestroy(&sc);
FLOG(_L("CFMSServer::DeleteScheduledRemindersL <<"));
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:72,代码来源:fmsserver.cpp
示例2: GetFDataTag
//---------------------------------------------------------------------------
TData __fastcall MyArhiv::GetFDataTag(TDateTime DateArhiv, int IDTag)
{
struct TData Ret;
static TDateTime Old;
static char NameCurDir[255];
static AnsiString TekDir ;
static bool first=true ;
int handle_file ;
static AnsiString OldName="" ;
static unsigned long kb = 0L;
static bool Error = true;
static double tim;
if (first) // определить текущую директорию
{
GetCurrentDirectory(255,NameCurDir);
TekDir = NameCurDir;
first = false ;
}
if (IDTag>=10000)
{
Ret.Status = 1;
Ret.Val = 0;
Ret.YesData = true;
return Ret;
}
if (Old!=DateArhiv)
{
AnsiString ARHIV = "ARHIV";
AnsiString YEAR = DateArhiv.FormatString("yyyy");
AnsiString MON = DateArhiv.FormatString("mm") ;
AnsiString DAT = DateArhiv.FormatString("dd") ;
AnsiString HOUR = DateArhiv.FormatString("hh") ;
int min = StrToInt(DateArhiv.FormatString("nn"));
int sec = StrToInt(DateArhiv.FormatString("ss"));
Old = DateArhiv;
AnsiString NameFile = TekDir+"\\"+ARHIV+"\\"+YEAR+"\\"+MON+"\\"+DAT+"\\" + HOUR +".dat";
Error=true;
if ((handle_file=_open(NameFile.c_str(),O_RDONLY|O_BINARY))>0) // чтение информации из файла
{
/* unsigned int kb_zag = sizeof(int)*ActiveArhiv->CountTags+sizeof(int);
unsigned int len_buf = ((sizeof(double)+sizeof(int))*ActiveArhiv->CountTags+sizeof(double))*3600; // (( значение и статус ) *кол-во тэгов + дата и время) 60 сек * 60 мин
unsigned char *buf; */
if (OldName!=NameFile) // разбор заголовка
{
lseek(handle_file,0L,SEEK_SET) ;
Error = false;
_read(handle_file,&kb,sizeof(int)); // размер заголовка
if (kb == sizeof(int)*ActiveArhiv->CountTags+sizeof(int)) // размер заголовка должен соответствовать количеству архивных тэгов
{
if (_read(handle_file,FArhivIDTags,sizeof(int)*ActiveArhiv->CountTags)!=(signed int)(sizeof(int)*ActiveArhiv->CountTags)) Error=true;
}
else Error = true;
OldName = NameFile;
}
else Error = false;
if (!Error)
{
unsigned long sm = min * 60 + sec;
sm = kb + sm * ((sizeof(double)+sizeof(int))*ActiveArhiv->CountTags+sizeof(double));
sm = lseek(handle_file,sm,SEEK_SET);
if (_read(handle_file,(unsigned char *)&tim,sizeof(double))!=sizeof(double)) Error=true;
else if (_read(handle_file,(unsigned char *)FArhivValTags,(unsigned int)(sizeof(double)*ActiveArhiv->CountTags))!=(signed int)(sizeof(double)*ActiveArhiv->CountTags)) Error=true;
else if (_read(handle_file,(unsigned char *)FArhivStatTags,sizeof(int)*ActiveArhiv->CountTags)!=(signed int)(sizeof(int)*ActiveArhiv->CountTags)) Error=true;
}
_close(handle_file);
handle_file = -1;
}
}
if ((tim==0)||(Error)) { FDataTag.YesData=false;FDataTag.Val=0;FDataTag.Status=1; }
else
{
FDataTag.YesData=false;
for (int pc=0;pc<FCountTags;pc++)
{
if (FArhivIDTags[pc]==IDTag)
{
FDataTag.Val = FArhivValTags[pc];
FDataTag.Status = FArhivStatTags[pc];
FDataTag.YesData = true;break;
}
}
if (!FDataTag.YesData) { FDataTag.Val=0;FDataTag.Status=1; }
}
Ret = FDataTag;
return Ret;
}
开发者ID:exclusiveLogin,项目名称:silicat_scada,代码行数:87,代码来源:ClassArhiv.cpp
示例3: FileOpen
//---------------------------------------------------------------------------
void __fastcall TFormLog::ButtonLogClick(TObject *Sender)
{
if(EditQRZ->Text=="") return;
int H;
AnsiString LogName = ThePath + "\\stream.adi";
if(FileExists(LogName))
{
H = FileOpen(LogName,fmOpenReadWrite);
if(H<0)
{
Application->MessageBox("Cannot write to log","IZ8BLY PSK31 Lab",MB_OK | MB_ICONSTOP);
return;
}
FileSeek(H,0,2);
}
else
{
H = FileCreate(LogName);
if(H<0)
{
Application->MessageBox("Cannot write to log","IZ8BLY PSK31 Lab",MB_OK | MB_ICONSTOP);
return;
}
FileWriteString(H,"Created by IZ8BLY PSK31 Lab\r\n<EOH>\r\n");
}
AnsiString Linea;
TDateTime TD;
if(UTCTimeLog)
{
SYSTEMTIME SystemTime;
GetSystemTime(&SystemTime);
TD = SystemTimeToDateTime(SystemTime);
}
else
{
TD = TDateTime().CurrentDateTime();
}
Linea = FormatAdif("CALL",EditQRZ->Text) +
FormatAdif("NAME",EditName->Text)+
FormatAdif("QTH",EditQTH->Text)+
FormatAdif("RST_RCVD",EditRSTReceived->Text)+
FormatAdif("RST_SENT",EditRSTSent->Text)+
FormatAdif("FREQ",EditFrequency->Text)+
FormatAdif("MODE","STREAM")+
FormatAdif("QSO_DATE",TD.FormatString("yyyymmdd"))+
FormatAdif("TIME_ON",TD.FormatString("hhmm"))+
FormatAdif("COMMENT",EditComments->Text)+
"<EOR>\r\n";
FileWriteString(H,Linea);
FileClose(H);
char oldclip[2048];
Clipboard()->GetTextBuf(oldclip,2048);
Clipboard()->SetTextBuf(Linea.c_str());
SendMessage(HWND_BROADCAST,IZ8BLY,0,0);
Clipboard()->SetTextBuf(oldclip);
ButtonLog->Enabled = false;
}
开发者ID:nippur72,项目名称:Chip64,代码行数:67,代码来源:Log.cpp
示例4: CreateCalEntryL
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));
}
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:101,代码来源:tcal_delete.cpp
示例5: DateTimeToString
UnicodeString DateTimeToString(TDateTime DateTime)
{
return DateTime.FormatString(L"");
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:4,代码来源:Sysutils.cpp
示例6: PrintfDateTimeToDebugLog
// 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());
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:6,代码来源:lbstestutilities.cpp
示例7: RunSQL
//---------------------------------------------------------------------------
void __fastcall TBookNotAcceptListForm::FormShow(TObject *Sender)
{
CString szSQL;
unsigned short year,month,day;
edtDays->Text="2";
m_lstCorpID.Add("");
lstCorp->Items->Add("全部");
szSQL="select * from DepartCorp order by dc_code";
RunSQL(dm1->Query1,szSQL,true);
while(!dm1->Query1->Eof)
{
m_lstCorpID.Add(dm1->Query1->FieldByName("dc_code")->AsString.c_str());
lstCorp->Items->Add(dm1->Query1->FieldByName("dc_name")->AsString);
dm1->Query1->Next();
}
lstCorp->ItemIndex=0;
m_lstDepartID.Add("");
lstDepart->Items->Add("全部");
szSQL="select * from StockDepart order by sd_code";
RunSQL(dm1->Query1,szSQL,true);
while(!dm1->Query1->Eof)
{
m_lstDepartID.Add(dm1->Query1->FieldByName("sd_code")->AsString.c_str());
lstDepart->Items->Add(dm1->Query1->FieldByName("sd_name")->AsString);
dm1->Query1->Next();
}
lstDepart->ItemIndex=0;
m_lstAskDepID.Add("");
lstAskDep->Items->Add("全部");
szSQL="select * from DicDepart,DepartCorp where dc_code=substring(dd_code,1,2) order by dd_code";
RunSQL(dm1->Query1,szSQL,true);
while(!dm1->Query1->Eof)
{
m_lstAskDepID.Add(dm1->Query1->FieldByName("dd_code")->AsString.c_str());
lstAskDep->Items->Add(dm1->Query1->FieldByName("dc_name")->AsString
+dm1->Query1->FieldByName("dd_name")->AsString);
dm1->Query1->Next();
}
lstAskDep->ItemIndex=0;
m_lstFactID.Add("");
lstFact->Items->Add("全部");
szSQL="select * from Manufactur order by mf_code";
RunSQL(dm1->Query1,szSQL,true);
while(!dm1->Query1->Eof)
{
m_lstFactID.Add(dm1->Query1->FieldByName("mf_code")->AsString.c_str());
lstFact->Items->Add(dm1->Query1->FieldByName("mf_shortname")->AsString);
dm1->Query1->Next();
}
lstFact->ItemIndex=0;
TDateTime tNow;
tNow=GetSysTime(false);
tNow.DecodeDate(&year,&month,&day);
DateTimePicker1->Date=tNow;
DateTimePicker2->Date=tNow;
}
开发者ID:25311753,项目名称:asi,代码行数:64,代码来源:BookNotAcceptList.cpp
示例8: GetDateTimeFromConfig
TBool CDataWrapperBase::GetDateTimeFromConfig(const TDesC& aSectName, TDateTime& aResult)
{
TInt year , month , day , hour , minute, second, microsecond ;
// Fields
_LIT(KYear, "year");
_LIT(KMonth, "month");
_LIT(KDay, "day");
_LIT(KHour, "hour");
_LIT(KMinute, "minute");
_LIT(KSecond, "second");
_LIT(KMicrosecond, "microsecond");
TBool ret = ETrue ;
if ( !GetIntFromConfig( aSectName, KYear , year))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KMonth , month))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KDay, day))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KHour, hour))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KMinute , minute))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KSecond , second))
{
ret=EFalse;
}
if ( !GetIntFromConfig( aSectName, KMicrosecond , microsecond))
{
ret=EFalse;
}
if ( ret )
{
TMonth amonth ;
switch (month)
{
case 1:
amonth = EJanuary ;
break ;
case 2:
amonth = EFebruary ;
break ;
case 3 :
amonth = EMarch ;
break ;
case 4:
amonth = EApril ;
break ;
case 5:
amonth = EMay ;
break ;
case 6 :
amonth = EJune ;
break ;
case 7 :
amonth = EJuly ;
break ;
case 8 :
amonth = EAugust ;
break ;
case 9 :
amonth = ESeptember ;
break ;
case 10 :
amonth = EOctober ;
break ;
case 11 :
amonth = ENovember ;
break ;
case 12:
amonth = EDecember ;
break ;
default :
return ret ;
}
aResult.Set(year,amonth ,day,hour,minute,second,microsecond);
}
return ret ;
}
开发者ID:fedor4ever,项目名称:default,代码行数:92,代码来源:DataWrapperBase.cpp
示例9: showScreenEntry
//---------------------------------------------------------------------------
void TGJVQSOEditFrame::selectEntry( BaseContact *slct )
{
selectedContact = slct; // contact from log list selected
FirstUnfilledButton->Visible = false;
CatchupButton->Visible = false;
screenContact.copyFromArg( *slct );
showScreenEntry();
PriorButton->Enabled = getPriorContact();
NextButton->Enabled = getNextContact();
InsertAfterButton->Enabled = getNextContact(); // dont allow insert after last contact
MainOpComboBox->Text = screenContact.op1.c_str();
SecondOpComboBox->Text = screenContact.op2.c_str();
if ( !contest->isReadOnly() && (screenContact.contactFlags & TO_BE_ENTERED || catchup))
{
// Uri Mode - catchuping QSOs from paper while logging current QSOs
// and we need to set the date/time from the previous contact
TimeEdit->ReadOnly = false;
DateEdit->ReadOnly = false;
int tne = screenContact.time.notEntered(); // partial dtg will give +fe
// full dtg gives -ve, none gives 0
if ( tne == 0 )
{
BaseContact * pct = getPriorContact();
if ( pct )
{
screenContact.time = pct->time;
DateEdit->Text = screenContact.time.getDate( DTGDISP ).c_str();
TimeEdit->Text = screenContact.time.getTime( DTGDISP ).c_str();
}
else
{
// use contest start time
TDateTime DTGStart = CanonicalToTDT(contest->DTGStart.getValue().c_str());
DateEdit->Text = DTGStart.FormatString("dd/mm/yy");
TimeEdit->Text = DTGStart.FormatString("hh:nn");
dtg time(false);
time.setDate( DateEdit->Text.c_str(), DTGDISP );
time.setTime( TimeEdit->Text.SubString(1, 5).c_str(), DTGDISP );
screenContact.time = time;
}
int selpt = DateEdit->Text.Length();
if ( selpt > 2 )
{
DateEdit->SelStart = 1;
DateEdit->SelLength = 1;
}
selpt = TimeEdit->Text.Length();
if ( selpt > 0 )
{
TimeEdit->SelStart = selpt - 1;
TimeEdit->SelLength = 1;
}
}
}
else
{
TimeEdit->ReadOnly = true;
DateEdit->ReadOnly = true;
}
SerTXEdit->ReadOnly = true;
bool timeOK = false;
int tne = screenContact.time.notEntered(); // partial dtg will give +fe
// full dtg gives -ve, none gives 0
if (tne < 0)
{
dtg time(false);
time.setDate( DateEdit->Text.c_str(), DTGDISP );
time.setTime( TimeEdit->Text.SubString(1, 5).c_str(), DTGDISP );
timeOK = contest->checkTime(time);
}
// DateEdit->Font->Assign(MinosParameters::getMinosParameters() ->getSysFont());
// TimeEdit->Font->Assign(MinosParameters::getMinosParameters() ->getSysFont());
if (timeOK)
{
DateEdit->Font->Color = clWindowText;
TimeEdit->Font->Color = clWindowText;
}
else
{
DateEdit->Font->Color = clRed;
TimeEdit->Font->Color = clRed;
}
MinosLoggerEvents::SendAfterSelectContact(catchup?0:slct, contest);
selectField( 0 );
}
开发者ID:BackupTheBerlios,项目名称:minos-svn,代码行数:97,代码来源:QSOEditFrame.cpp
示例10: ASSERT
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();
}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:70,代码来源:tstartsafe_procmonsysrestart.cpp
示例11: DriverNameToNumber
void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
QList< FmRestoreInfo > &restoreInfoList,
const QString& aDrive )
{
int targetDrive = DriverNameToNumber( aDrive );
restoreInfoList.clear();
///////
iDrvAndOpList->Reset();
iBkupCategoryList->ResetAndDestroy();
for( QList<FmBkupDrivesAndOperation* >::iterator it = drivesAndOperationList.begin();
it != drivesAndOperationList.end(); ++it )
{
FmBkupDrivesAndOperation* fmDrvAndOp = *it;
TBkupDrivesAndOperation drvAndOp;
drvAndOp.setOwnerDataType( fmDrvAndOp->ownerDataType() );
drvAndOp.setDrvCategories( fmDrvAndOp->drvCategories() );
iDrvAndOpList->AppendL( drvAndOp );
}
////////
CMMCScBkupOpParamsRestoreFull* params =
CMMCScBkupOpParamsRestoreFull::NewL(
iDrvAndOpList, FmBkupEngine::EBUCatAllSeparately );
CleanupStack::PushL( params );
// Get list of all archives
RPointerArray< CMMCScBkupArchiveInfo > archives;
TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives );
CleanupStack::PushL( cleanupItem );
iBkupEngine->ListArchivesL(
archives,
params,
AllowedDriveAttMatchMask(),
targetDrive );
// Fill restore info
TInt count( archives.Count() );
// restoreInfoList.ReserveL( count );
for( TInt i( 0 ); i < count; ++i )
{
// Content
CMMCScBkupArchiveInfo& archiveInfo( *archives[ i ] );
TUint32 iContent = BkupToFmgrMask( archiveInfo.Category().iFlags );
TTime iTime = archiveInfo.DateTime();
TInt iDrive = archiveInfo.Drive();
TDateTime iDateTime = iTime.DateTime();
int h = iDateTime.Hour();
int m = iDateTime.Minute();
int s = iDateTime.Second();
int year = iDateTime.Year();
int month = iDateTime.Month() + 1;
int day = iDateTime.Day()+1;
QTime time( h, m, s);
QDate date( year, month, day );
QDateTime dateTime( date, time );
dateTime = dateTime.toLocalTime();
FmRestoreInfo restoreInfo( iContent, dateTime, NumberToDriverName( iDrive ) );
restoreInfoList.append( restoreInfo );
}
CleanupStack::PopAndDestroy( &archives );
CleanupStack::PopAndDestroy( params );
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:71,代码来源:fmbkupengine_p.cpp
示例12: FUNC_ENTER
// ---------------------------------------------------------------------------
// CLbtCleanupHandler::WriteCleanupDataToFileL
// ---------------------------------------------------------------------------
//
void CLbtCleanupHandler::WriteCleanupDataToFileL()
{
FUNC_ENTER("CLbtCleanupHandler::WriteCleanupDataToFileL");
RFs fs;
User::LeaveIfError( fs.Connect() );
CleanupClosePushL( fs );
// Obtain the file path
TFileName file;
// Gets the path in which the file can be created
fs.SessionPath(file);
// Create the file Directory ie the private directory of the process
fs.MkDirAll(file);
// Append the name of the file
file.Append(KLbtAppCleanupFileName);
// Open write stream to write to the file
RFileWriteStream writeStream;
// Open the file to replace the contents. If the file is not preset
// this method will create the file
TInt error = writeStream.Replace( fs, file, EFileWrite );
if( error != KErrNone )
{
ERROR("Opening of cleanup file failed with : %d", error);
writeStream.Close();
CleanupStack::PopAndDestroy(); //fs
User::Leave(error);
}
CleanupClosePushL( writeStream );
// First write the number of cleanup items
writeStream.WriteInt16L( iCleanupItems.Count() );
for(TInt i=0;i<iCleanupItems.Count();++i)
{
RArray<TLbtTriggerId>& triggers = iCleanupItems[i]->GetTriggers();
// Write the trigger ids into the file
writeStream.WriteInt16L( triggers.Count() );
for(TInt j=0;j<triggers.Count();++j)
{
writeStream.WriteUint32L( triggers[j] );
}
// Write the time into the file
const TDateTime dateTime = iCleanupItems[i]->GetTime().DateTime();
// Write the year
writeStream.WriteInt32L( dateTime.Year() );
// Write the month
writeStream.WriteInt32L( dateTime.Month() );
// Write the day
writeStream.WriteInt32L( dateTime.Day() );
}
CleanupStack::PopAndDestroy(2); //fs and writeSteam
}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:69,代码来源:lbtcleanuphandler.cpp
示例13: VehicleDataCallbackFuc
// 抓拍数据
void CALLBACK VehicleDataCallbackFuc(void *pUserData, VehicleData *pData)
{
TForm1 *pThis = (TForm1 *)pUserData;
if(pThis->tvConnectDev->Selected == NULL) return;
String strIP;
bool bFlag = false;
PDevInfo pDev = NULL;
TTreeNodes *nodes = pThis->tvConnectDev->Items;
if(nodes != NULL)
{
for(int i = 0; i < nodes->Count; i++)
{
if(TreeView_GetCheckState(pThis->tvConnectDev->Handle,nodes->Item[i]->ItemId))
{
String strViewIP = nodes->Item[i]->Text;
// 只显示指定抓拍的设备数据
strIP.sprintf("%s", pData->ucDeviceIP);
if(strIP == strViewIP)
{
bFlag = true;
break;
}
}
}
}
if(!bFlag) return;
int nColor = pData->PlateColor;
TDateTime dataTime = Now();
SYSTEMTIME tm;
GetSystemTime(&tm);
String strPlate = (char *)pData->ucPlate;
String strPath;
String strBigFile, strCifFile, strPlateFile, strPlateNoFile;
int iFileHandle = 0;
// 大图
if(pData->pucBigImage != NULL && pData->uiBigImageLen > 0)
{
strPath = pThis->strImagePath + strIP + "\\大图\\" + FormatDateTime("yyyymmdd", dataTime) + "\\";
pThis->CreateDirectoryRecurrent(strPath);
strBigFile = Format("%s%s%03d(%s).jpg", ARRAYOFCONST((strPath, dataTime.FormatString("hhmmss"), tm.wMilliseconds, strPlate)));
iFileHandle = FileCreate(strBigFile);
if(iFileHandle != 0)
{
FileWrite(iFileHandle, pData->pucBigImage, pData->uiBigImageLen);
FileClose(iFileHandle);
if(FileExists(strBigFile))
{
pThis->imgBigImg->Picture->LoadFromFile(strBigFile);
}
}
}
// CIF图
if(pData->pucCIFImage != NULL && pData->uiCIFImageLen > 0)
{
strPath = pThis->strImagePath + strIP + "\\CIF图\\" + dataTime.FormatString("yyyymmdd") + "\\";
pThis->CreateDirectoryRecurrent(strPath);
strCifFile = Format("%s%s%03d(%s).jpg", ARRAYOFCONST((strPath, dataTime.FormatString("hhmmss"), tm.wMilliseconds, strPlate)));
iFileHandle = FileCreate(strCifFile);
if(iFileHandle != 0)
{
FileWrite(iFileHandle, pData->pucCIFImage, pData->uiCIFImageLen);
FileClose(iFileHandle);
if(FileExists(strCifFile))
{
pThis->imgCIFImg->Picture->LoadFromFile(strCifFile);
}
}
}
// 车牌图
if(pData->pucPlateImage != NULL && pData->uiPlateImageLen > 0)
{
strPath = pThis->strImagePath + strIP + "\\车牌图\\" + dataTime.FormatString("yyyymmdd") + "\\";
pThis->CreateDirectoryRecurrent(strPath);
strPlateFile = Format("%s%s%03d(%s).jpg", ARRAYOFCONST((strPath, dataTime.FormatString("hhmmss"), tm.wMilliseconds, strPlate)));
iFileHandle = FileCreate(strPlateFile);
if(iFileHandle != 0)
{
FileWrite(iFileHandle, pData->pucPlateImage, pData->uiPlateImageLen);
FileClose(iFileHandle);
}
if(FileExists(strPlateFile))
{
pThis->imgPlateImg->Picture->LoadFromFile(strPlateFile);
}
}
// 车牌号码
//.........这里部分代码省略.........
开发者ID:houzhenggang,项目名称:zhitonghuiyuan,代码行数:101,代码来源:MainUnit.cpp
示例14: CheckVersion
//---------------------------------------------------------------------------
// Check to see if SelfImage is up-to-date - notify the user if it isn't
//
void CheckVersion(void) {
TDateTime *dtLastCheck = NULL;
char *filename = NULL;
char *buffer = NULL;
char *verbuff = NULL;
unsigned nVersionInfoSize;
int nBuildPos;
static AnsiString sMyVersion = "";
static int nMyBuild = 0;
AnsiString sCurrentVersion, sURL;
int nCurrentBuild = 0;
TIdHTTP *HTTP;
DWORD nDummy;
__ENTERFUNCTION__;
try {
try {
formSelfImageNewVersionNotify = NULL;
if (!SelfImageConfig->Values["Update Notify"]) {
LOG(LOG_DEBUG, "Update Notify is turned off - not checking for new version.");
goto END; // Ugly - C++ Builder silently ignores a __finally block if a return is process from a nested try.
} // if (!SelfImageConfig->Values["Update Notify"])
if (String(SelfImageConfig->Values["Last Version Check"]).IsEmpty())
SelfImageConfig->Values["Last Version Check"] = (Now()-1).DateTimeString();
dtLastCheck = new TDateTime(String(SelfImageConfig->Values["Last Version Check"]));
if (!DaysBetween(Now(), *dtLastCheck)) {
LOG1(LOG_DEBUG, "Last new version check was performed %s - not checking again.", dtLastCheck->DateTimeString().c_str());
goto END; // Ugly - C++ Builder silently ignores a __finally block if a return is process from a nested try.
} // if (!DaysBetween(Now(), *dtLastCheck))
SelfImageConfig->Values["Last Version Check"] = Now().DateTimeString();
// Get this executable's version - this is a pain, so let's just do it once for each time SelfImage is instantiated
if (!nMyBuild) {
LOG(LOG_DEBUG, "Retrieving internal version number.");
filename = (char *)malloc(MAXPATH);
GetModuleFileName(HInstance, filename, MAXPATH);
nVersionInfoSize = GetFileVersionInfoSize(filename, &nDummy);
// These following three exceptions should never make it to the user except through the logs in a debug build.
// Since they are only for logging, they are allowed to have text that doesn't come from the string table.
if (!nVersionInfoSize)
throw ESelfImageSystemError("GetFileVersionInfoSize() failed: " + GetLastErrorMessage());
buffer = (char *)malloc(nVersionInfoSize);
if (!GetFileVersionInfo(filename, NULL, nVersionInfoSize, buffer))
throw ESelfImageSystemError("GetFileVersionInfo() failed:" + GetLastErrorMessage());
if (!VerQueryValue(buffer, "\\StringFileInfo\\100904E4\\FileVersion", (void **)&verbuff, NULL))
throw ESelfImageSystemError("VerQueryValue() failed:" + GetLastErrorMessage());
sMyVersion = verbuff;
nBuildPos = sMyVersion.LastDelimiter(".");
nMyBuild = sMyVersion.SubString(nBuildPos + 1, sMyVersion.Length() - nBuildPos).ToInt();
sMyVersion = sMyVersion.SubString(1,nBuildPos-1) + " (Build " + String(nMyBuild) + ")";
LOG1(LOG_MESSAGE, "Internal version string retrieved from resources: \"%s\".", sMyVersion.c_str());
} // if (sMyVersion.IsEmpty())
// Get SelfImage's current version from the interweb - woo, this is cool
HTTP = new TIdHTTP(NULL);
sURL = SelfImageConfig->Values["Version URL"];
LOG1(LOG_DEBUG, "Attempting to retrieve version string from URL \"%s\".", sURL.c_str());
try {
sCurrentVersion = HTTP->Get(SelfImageConfig->Values["Version URL"]);
nBuildPos = sCurrentVersion.Pos("(Build ");
nCurrentBuild = sCurrentVersion.SubString(nBuildPos + 7, sCurrentVersion.Length() - nBuildPos - 7).ToInt();
}
catch (...) { sCurrentVersion = ""; }
delete HTTP;
#ifdef __LOGGINGENABLED__
if (!sCurrentVersion.IsEmpty())
LOG2(LOG_MESSAGE, "Version string \"%s\" retrieved from %s.", sCurrentVersion.c_str(), sURL.c_str())
else
LOG2(LOG_WARNING, "Unable to retrieve version string from URL \"%s\": %s", sURL.c_str(), HTTP->ResponseText.c_str());
#endif
// Compare the two...
if (nCurrentBuild && nMyBuild < nCurrentBuild && sCurrentVersion != String(SelfImageConfig->Values["Notify Squelch"])) {
LOG(LOG_DEBUG, "Notifying user of new version.");
formSelfImageNewVersionNotify = new TformSelfImageNewVersionNotify(NULL, sMyVersion, sCurrentVersion);
if (formSelfImageNewVersionNotify->ShowModal() == mrCancel)
SelfImageConfig->Values["Notify Squelch"] = sCurrentVersion;
} // if (different versions)
} // inner try
catch (Exception &e) {
LOG2(LOG_ERROR, "Exception of type \"%s\" raised during new version check with message \"%s\"", String(e.ClassName()).c_str(), e.Message.c_str());
} // catch
} // outer try
__finally {
if (dtLastCheck)
delete dtLastCheck;
if (filename)
free(filename);
if (buffer)
free(buffer);
if (formSelfImageNewVersionNotify) {
delete formSelfImageNewVersionNotify;
formSelfImageNewVersionNotify = NULL;
//.........这里部分代码省略.........
开发者ID:Thema89,项目名称:Selfimage-plus,代码行数:101,代码来源:SelfImage_Utility.cpp
示例15: MakeTimeStrFile
void TAzenqosEngineUtils::MakeTimeStrFile(TTime &time,TDes& str) //str should be at least 19 in length
{
TDateTime date = time.DateTime();
str.Format(KTimeStampFileFormat,date.Year()%2000,date.Month()+1,date.Day()+1,date.Hour(),date.Minute(),date.Second());
}
开发者ID:ykasidit,项目名称:AzqGenUtils,代码行数:5,代码来源:AzenqosEngineUtils.cpp
示例16: CompareDate
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()));
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:10,代码来源:t_httphdr.cpp
示例17: ParseTimeStrMilliL
void TAzenqosEngineUtils::ParseTimeStrMilliL(const TDesC& str,TTime &time)
{
TInt instrlen = str.Length();
if(str.Length() != KTimeStampMillisecStrLen )
User::Leave(KErrBadName);
TDateTime date;
TPtrC ptr(0,0);
TInt pos=0;
TLex lex;
TInt val;
//_LIT(KTimeStampMillisecFormat,"%02d%02d%02d_%02d:%02d:%02d.%03d");
///year
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
val+=2000;
User::LeaveIfError(date.SetYear(val));
//month
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<1 || val > 12)//month should be at least 1 so we can set as symbian format: month-1
User::Leave(KErrGeneral);
val--;//Symbian format EJanuary is 0
User::LeaveIfError(date.SetMonth((TMonth)val));
//day
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<1 || val > 31)//day limit
User::Leave(KErrGeneral);
val--;//Symbian format EJanuary is 0
User::LeaveIfError(date.SetDay(val));
//skip '_'
pos+=1;
//HH
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<0 || val > 23)//0 to 23 Hrs
User::Leave(KErrGeneral);
User::LeaveIfError(date.SetHour(val));
//skip ':'
pos+=1;
//MM
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<0 || val > 59)//0 to 59 mins
User::Leave(KErrGeneral);
User::LeaveIfError(date.SetMinute(val));
//skip ':'
pos+=1;
//SS
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<0 || val > 59)//0 to 59 Seconds
User::Leave(KErrGeneral);
User::LeaveIfError(date.SetSecond(val));
//skip '.'
pos+=1;
//SSS
ptr.Set(str.Mid(pos,3));
pos+=3;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<0 || val > 999999)//0 to 999999 MicroSeconds
User::Leave(KErrGeneral);
User::LeaveIfError(date.SetMicroSecond(val));
time = date;
//.........这里部分代码省略.........
开发者ID:ykasidit,项目名称:AzqGenUtils,代码行数:101,代码来源:AzenqosEngineUtils.cpp
|
请发表评论