当前位置: 首页>>代码示例>>C++>>正文


C++ FormatDateTime函数代码示例

本文整理汇总了C++中FormatDateTime函数的典型用法代码示例。如果您正苦于以下问题:C++ FormatDateTime函数的具体用法?C++ FormatDateTime怎么用?C++ FormatDateTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FormatDateTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void __fastcall TfrmSearch::menuAddParameterClick(TObject *Sender)
{
/*  frmEditSearchParam->cbxField->ItemIndex = -1;
  frmEditSearchParam->txtContext->Text = "";
  frmEditSearchParam->cbxOperator->ItemIndex = 0;
  frmEditSearchParam->cbxValues->Text = "";
  frmEditSearchParam->cbxAndOr->ItemIndex = 0;
  frmEditSearchParam->cbxFieldChange(NULL);*/
  if(frmEditSearchParam->ShowModal() == mrOk)
  {
    TListItem * Item = lvParams->Items->Add();
    Item->ImageIndex = 48;
    TBillField * Field = (TBillField * )frmEditSearchParam->cbxField->Items->Objects[frmEditSearchParam->cbxField->ItemIndex];
    Item->Data = (void *)Field;
    Item->SubItems->Add(Field->Label); 
    Item->SubItems->Add(frmEditSearchParam->cbxOperator->Text); 
    //Item->SubItems->Add(frmEditSearchParam->cbxAndOr->Text);
    if(frmEditSearchParam->txtContext->Visible)
      Item->SubItems->Add(frmEditSearchParam->txtContext->Text);
    else if(frmEditSearchParam->cbxValues->Visible)
      Item->SubItems->Add(frmEditSearchParam->cbxValues->Text);
    else
      Item->SubItems->Add(
        FormatDateTime("yyyy-mm-dd",frmEditSearchParam->dtDate->DateTime) + " " +
        FormatDateTime("hh:nn:ss",frmEditSearchParam->dtTime->DateTime));
    if(frmEditSearchParam->cbxMatch->Checked)
      Item->SubItems->Add("√");
    else
      Item->SubItems->Add("");     
  } 
}
开发者ID:josecohenca,项目名称:xmlconvertsql,代码行数:31,代码来源:SearchFrm.cpp

示例2: TRACE

HRESULT WINAPI CRecycleBin::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, LPSHELLDETAILS pDetails)
{
    PIDLRecycleStruct * pFileDetails;
    WCHAR buffer[MAX_PATH];
    WCHAR szTypeName[100];
    LPWSTR pszBackslash;
    UINT Length;

    TRACE("(%p, %p, %d, %p)\n", this, pidl, iColumn, pDetails);
    if (iColumn >= COLUMNS_COUNT)
        return E_FAIL;
    pDetails->fmt = RecycleBinColumns[iColumn].fmt;
    pDetails->cxChar = RecycleBinColumns[iColumn].cxChars;
    if (pidl == NULL)
        return SHSetStrRet(&pDetails->str, RecycleBinColumns[iColumn].column_name_id);

    if (iColumn == COLUMN_NAME)
        return GetDisplayNameOf(pidl, SHGDN_NORMAL, &pDetails->str);

    pFileDetails = _ILGetRecycleStruct(pidl);
    switch (iColumn)
    {
        case COLUMN_DATEDEL:
            FormatDateTime(buffer, MAX_PATH, &pFileDetails->DeletionTime);
            break;
        case COLUMN_DELFROM:
            pszBackslash = wcsrchr(pFileDetails->szName, L'\\');
            Length = (pszBackslash - pFileDetails->szName);
            memcpy((LPVOID)buffer, pFileDetails->szName, Length * sizeof(WCHAR));
            buffer[Length] = L'\0';
            break;
        case COLUMN_SIZE:
            StrFormatKBSizeW(pFileDetails->FileSize.QuadPart, buffer, MAX_PATH);
            break;
        case COLUMN_MTIME:
            FormatDateTime(buffer, MAX_PATH, &pFileDetails->LastModification);
            break;
        case COLUMN_TYPE:
            // FIXME: We should in fact use a UNICODE version of _ILGetFileType
            szTypeName[0] = L'\0';
            wcscpy(buffer, PathFindExtensionW(pFileDetails->szName));
            if (!( HCR_MapTypeToValueW(buffer, buffer, _countof(buffer), TRUE) &&
                    HCR_MapTypeToValueW(buffer, szTypeName, _countof(szTypeName), FALSE )))
            {
                /* load localized file string */
                szTypeName[0] = '\0';
                if(LoadStringW(shell32_hInstance, IDS_ANY_FILE, szTypeName, _countof(szTypeName)))
                {
                    szTypeName[63] = '\0';
                    StringCchPrintfW(buffer, _countof(buffer), szTypeName, PathFindExtensionW(pFileDetails->szName));
                }
            }
            return SHSetStrRet(&pDetails->str, szTypeName);
        default:
            return E_FAIL;
    }

    return SHSetStrRet(&pDetails->str, buffer);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:59,代码来源:CRecycleBin.cpp

示例3: WriteToLog

void WriteToLog(String S) {
	HANDLE LogFile;
	String LogPath;
	String LogFileName;
	DWORD dwSize;
	AnsiString SS;
	TDateTime DateTime;
	LPDWORD NumberOfBytesWritten = new DWORD;

	try { // except
		DateTime = Now();

		LogPath = ExtractFilePath(Application->ExeName) + LoadStr(IDS_LOG_PATH);
		if (!DirectoryExists(LogPath))
			CreateDir(LogPath);

		LogFileName = IncludeTrailingPathDelimiter(LogPath) +
			ChangeFileExt(ExtractFileName(Application->ExeName),
			LoadStr(IDS_LOG_EXT));

		LogFile = CreateFile(LogFileName.w_str(), GENERIC_READ, FILE_SHARE_READ,
			NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);

		dwSize = 0;
		if (LogFile != INVALID_HANDLE_VALUE) {
			dwSize = GetFileSize(LogFile, NULL);
			CloseHandle(LogFile);
		}

		if (dwSize > MaxLogSize) {
			String NewFileName = IncludeTrailingPathDelimiter(LogPath) +
				OnlyFileName(Application->ExeName) + SPACE + FormatDateTime
				(LoadStr(IDS_DATETIME_FORMAT_FILENAME), DateTime) +
				LoadStr(IDS_LOG_EXT);
			MoveFile(LogFileName.w_str(), NewFileName.w_str());
		}

		LogFile = CreateFile(LogFileName.w_str(), GENERIC_WRITE,
			FILE_SHARE_READ, NULL, OPEN_ALWAYS,
			FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_COMPRESSED, 0);

		if (LogFile != INVALID_HANDLE_VALUE) {
			SS = AnsiString(FormatDateTime(LoadStr(IDS_DATETIME_FORMAT_LOG),
				DateTime) + "; " + AnsiReplaceStr(S, sLineBreak, SPACE) +
				sLineBreak);

			if (SetFilePointer(LogFile, 0, NULL,
				FILE_END) != INVALID_SET_FILE_POINTER)
				WriteFile(LogFile, SS.c_str(), SS.Length(),
				NumberOfBytesWritten, NULL);

			CloseHandle(LogFile);
		}
	}
	catch (...) {
	}
}
开发者ID:P3tr0viCh,项目名称:UtilsAndComps,代码行数:57,代码来源:UtilsLog.cpp

示例4: FormatDateTime

void __fastcall TFrmAlarmDetailList::ChartAlarmClickSeries(TCustomChart *Sender, TChartSeries *Series,
		  int ValueIndex, TMouseButton Button, TShiftState Shift, int X,
		  int Y)
{
	String strStartDateTime = FormatDateTime("yyyy-mm-dd 오전 00:00:00", DateTimeAlarmStart->Date);
	String strEndDateTime = FormatDateTime("yyyy-mm-dd 오전 00:00:00", DateTimeAlarmEnd->Date + 1);

	try
	{
		AnsiString szQuery = " select *, count(Alarm_idx) AS Frequency from AlarmLog "
							  " where Set_date BETWEEN '" + strStartDateTime + "' AND '" + strEndDateTime + "'"
							  " AND Alarm_idx < 1000 group by Alarm_idx order by Frequency DESC;";

		CppSQLite3Table OrderedTable = dbMain.getTable(szQuery.c_str());
		OrderedTable.setRow(ValueIndex);
		AnsiString strCode = (String)OrderedTable.fieldValue("Alarm_idx");

		AnsiString szAlarmQuery = " select * from AlarmLog, Alarm, Groups, Recipe where Alarm_idx like " + strCode +
								" AND Set_date BETWEEN '" + strStartDateTime + "' AND '" + strEndDateTime + "'"
								" AND AlarmLog.Alarm_idx = Alarm.idx"
								" AND AlarmLog.Group_idx = Groups.idx"
                                " AND AlarmLog.group_idx = Recipe.group_idx"
								" AND AlarmLog.Recipe_idx = Recipe.idx ORDER BY Set_Date DESC";

		CppSQLite3Table SelectedTable = dbMain.getTable(szAlarmQuery.c_str());
		for(int i = 1; i < grdAlarmLog->RowCount; i++)
		{
			grdAlarmLog->Rows[i]->Clear();
		}

		grdAlarmLog->RowCount = 2;

		if (SelectedTable.numRows() > 0)
		{
			for(int row = 0; row < SelectedTable.numRows(); row++)
			{
				SelectedTable.setRow(row);

				grdAlarmLog->Cells[0][row+1] = IntToStr(row+1);
				grdAlarmLog->Cells[1][row+1] = (String)SelectedTable.fieldValue(7);		// Start date
				grdAlarmLog->Cells[2][row+1] = (String)SelectedTable.fieldValue(8);		// End date
				grdAlarmLog->Cells[3][row+1] = (String)SelectedTable.fieldValue(9);		// Alarm Code
				grdAlarmLog->Cells[4][row+1] = (String)SelectedTable.fieldValue(11);	// Alarm Name
				grdAlarmLog->RowCount = row+2;
			}
		}

	}
	catch (CppSQLite3Exception& e)
	{
		cerr << e.errorCode() << ":" << e.errorMessage() << endl;
	}

}
开发者ID:japgo,项目名称:mygithub,代码行数:54,代码来源:AlarmDetailScrn.cpp

示例5: check_fill

int check_fill()
{
	Card.date_create = Form_Create->DateTimePicker_DateCreate->Date;

	if (Form_Create->Edit_Number->Text == "") {
	   ShowMessage("Enter number value");
	   return 0;
	} else {
		Card.number = StrToInt(Form_Create->Edit_Number->Text);
	}

	Card.department_number = Form_Create->ComboBox_DepartmentNumber->ItemIndex+1;

	if (Form_Create->Edit_DirectoryNumber->Text == "") {
	   ShowMessage("Enter directory number value");
	   return 0;
	} else {
		Card.directory_number = StrToInt(Form_Create->Edit_DirectoryNumber->Text);
	}

	/*<control>*/
	if (Form_Create->Edit_ControlNumber->Enabled && Form_Create->DateTimePicker_ControlNumberData->Enabled) {
		Card.control_number = Form_Create->Edit_ControlNumber->Text;
		Card.control_number_data = Form_Create->DateTimePicker_ControlNumberData->Date;
	} else {
		Card.control_number = NULL;
		Card.control_number_data = NULL;
	}
	/*</control>*/

	if (Form_Create->Memo_Description->Text == "") {
		ShowMessage("Enter description value");
		return 0;
	} else {
		Card.description = Form_Create->Memo_Description->Text;
	}

	Card.address = Form_Create->Memo_Address->Text;
	Card.post_type = Form_Create->ComboBox_PostType->ItemIndex;

	if (Form_Create->Edit_NomenclatureDirectory->Text == "") {
		Card.nomenclature_directory = NULL;
	} else {
		Card.nomenclature_directory = StrToInt(Form_Create->Edit_NomenclatureDirectory->Text);
	}

	if (FormatDateTime("dd.mm.yyyy",StrToDateTime(Card.control_number_data)) >
		FormatDateTime("dd.mm.yyyy",StrToDateTime(Card.date_create))) {
        ShowMessage("Date control > date document");
		return 0;
	}

	return 1;
}
开发者ID:jazzzdima,项目名称:xsod_win,代码行数:54,代码来源:src.cpp

示例6: TraceDumpToFile

void TraceDumpToFile()
{
    if (TraceFile != nullptr)
    {
        TGuard Guard(TracingCriticalSection);

        DWORD Written;

        TDateTime N = Now();
#ifdef TRACE_IN_MEMORY_NO_FORMATTING
        DWORD Ticks = GetTickCount();
#endif

        const UnicodeString TimestampFormat = L"hh:mm:ss.zzz";
        UnicodeString TimeString = FormatDateTime(TimestampFormat, N);

        UTF8String Buffer = UTF8String(
                                FORMAT("[%s] Dumping in-memory tracing =================================\n",
                                       (TimeString)));
        WriteFile(TraceFile, Buffer.c_str(), Buffer.Length(), &Written, nullptr);

        TTracesInMemory::const_iterator i = TracesInMemory.begin();
        while (i != TracesInMemory.end())
        {
#ifdef TRACE_IN_MEMORY_NO_FORMATTING
            const wchar_t * SourceFile = i->SourceFile;
            const wchar_t * Slash = wcsrchr(SourceFile, L'\\');
            if (Slash != nullptr)
            {
                SourceFile = Slash + 1;
            }

            TimeString =
                FormatDateTime(TimestampFormat,
                               IncMilliSecond(N, -static_cast<int>(Ticks - i->Ticks)));
            Buffer = UTF8String(FORMAT(L"[%s] [%.4X] [%s:%d:%s] %s\n",
                                       (TimeString, int(i->Thread), SourceFile,
                                        i->Line, i->Func, i->Message)));
            WriteFile(TraceFile, Buffer.c_str(), Buffer.Length(), &Written, nullptr);
#else
            WriteFile(TraceFile, i->Message.c_str(), i->Message.Length(), &Written, nullptr);
#endif
            ++i;
        }
        TracesInMemory.clear();

        TimeString = FormatDateTime(TimestampFormat, Now());
        Buffer = UTF8String(
                     FORMAT("[%s] Done in-memory tracing =================================\n",
                            (TimeString)));
        WriteFile(TraceFile, Buffer.c_str(), Buffer.Length(), &Written, nullptr);
    }
}
开发者ID:michaellukashov,项目名称:Far-NetBox,代码行数:53,代码来源:Global.cpp

示例7: FormatDateTime

//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn2Click(TObject *Sender)
{
Memo2->Lines->Insert(0,Now().TimeString()+" 生成接驳文件。");

AnsiString DateChoose = "dt>'"+DateTimePicker1->Date.DateString()+" 00:00:00' and dt<'"+DateTimePicker1->Date.DateString()+" 23:59:59'";
// ShowMessage(DateChoose);
AnsiString sqlstr = "select * from TicketPay where 1=1 and "+DateChoose ;
 //ADOConnection1->Connected = true;
 ADOQuery1->Close();
 ADOQuery1->SQL->Clear();
 ADOQuery1->SQL->Add(sqlstr);
 ADOQuery1->Open();
 //ADOQuery1->Active =true;
 //Edit1->Text = IntToStr(ADOQuery1->RecordCount);
 //Memo1->Clear();

 AnsiString InsertString;
 Form2->Memo1->Lines->Clear();

 AnsiString  date1,date2,formati,pay_value;
 int i=0,p=0;

for(ADOQuery1->First();!ADOQuery1->Eof;ADOQuery1->Next())
 {
 //ShowMessage(ADOQuery1->FieldByName("dt")->AsString);
 //InsertString=ADOQuery1->FieldValues['dt'];
 InsertString=ADOQuery1->FieldByName("dt")->AsString;
 pay_value=ADOQuery1->FieldByName("pay_value")->AsString;
 //ShowMessage(InsertString);
 date1 = FormatDateTime("yyyy",InsertString)+"/"+FormatDateTime("mm",InsertString)+"/"+FormatDateTime("dd",InsertString);
 date2 = FormatDateTime("hhmm",InsertString);
 //rmati=Format("%010d",ARRAYOFCONST(i));
i++;
 //ShowMessage(10-IntToStr(i).Length());
int p=10-IntToStr(i).Length();
formati=IntToStr(i);
for(p;p>0;p=p-1)
{
     formati="0"+formati;
     //ShowMessage(formati);
}



 Form2->Memo1->Lines->Add(Edit2->Text+"\t"+Edit3->Text+"\t"+date1+"\t"+date2+"\t"+formati+"\t"+Edit2->Text+"01"+"\t\t"+pay_value+"\t"+"0.00\t0.00\t0.00\t0.00\t"+pay_value);

// ADOQuery1->Next();
 }
  Form2->ShowModal();
}
开发者ID:rogertl,项目名称:cbuilder,代码行数:51,代码来源:Unit1.cpp

示例8: play

	void NowPlayingWidget::SetStatistics (const QString& path)
	{
		auto stats = Core::Instance ().GetLocalCollection ()->GetTrackStats (path);
		const bool valid = stats.Added_.isValid ();
		Ui_.LastPlay_->setVisible (valid);
		Ui_.LabelLastPlay_->setVisible (valid);
		Ui_.StatsCount_->setVisible (valid);
		Ui_.LabelPlaybacks_->setVisible (valid);
		if (!valid)
			return;

		Ui_.LastPlay_->setText (FormatDateTime (stats.LastPlay_));
		Ui_.StatsCount_->setText (tr ("%n play(s) since %1", 0, stats.Playcount_)
					.arg (FormatDateTime (stats.Added_)));
	}
开发者ID:Akon32,项目名称:leechcraft,代码行数:15,代码来源:nowplayingwidget.cpp

示例9: RecycleBin_GetDetailsOf

static HRESULT WINAPI RecycleBin_GetDetailsOf(IShellFolder2 *iface, LPCITEMIDLIST pidl, UINT iColumn, LPSHELLDETAILS pDetails)
{
    RecycleBin *This = impl_from_IShellFolder2(iface);
    WIN32_FIND_DATAW data;
    WCHAR buffer[MAX_PATH];

    TRACE("(%p, %p, %d, %p)\n", This, pidl, iColumn, pDetails);
    if (iColumn >= COLUMNS_COUNT)
        return E_FAIL;
    pDetails->fmt = RecycleBinColumns[iColumn].fmt;
    pDetails->cxChar = RecycleBinColumns[iColumn].cxChars;
    if (pidl == NULL)
    {
        pDetails->str.uType = STRRET_WSTR;
        LoadStringW(shell32_hInstance, RecycleBinColumns[iColumn].column_name_id, buffer, MAX_PATH);
        return SHStrDupW(buffer, &pDetails->str.u.pOleStr);
    }

    if (iColumn == COLUMN_NAME)
        return RecycleBin_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL, &pDetails->str);

    TRASH_UnpackItemID(&pidl->mkid, &data);
    switch (iColumn)
    {
        case COLUMN_DATEDEL:
            FormatDateTime(buffer, MAX_PATH, data.ftLastAccessTime);
            break;
        case COLUMN_DELFROM:
            lstrcpyW(buffer, data.cFileName);
            PathRemoveFileSpecW(buffer);
            break;
        case COLUMN_SIZE:
            StrFormatKBSizeW(((LONGLONG)data.nFileSizeHigh<<32)|data.nFileSizeLow, buffer, MAX_PATH);
            break;
        case COLUMN_MTIME:
            FormatDateTime(buffer, MAX_PATH, data.ftLastWriteTime);
            break;
        case COLUMN_TYPE:
            /* TODO */
            buffer[0] = 0;
            break;
        default:
            return E_FAIL;
    }
    
    pDetails->str.uType = STRRET_WSTR;
    return SHStrDupW(buffer, &pDetails->str.u.pOleStr);
}
开发者ID:YokoZar,项目名称:wine,代码行数:48,代码来源:recyclebin.c

示例10: UniqTempDir

UnicodeString UniqTempDir(const UnicodeString & BaseDir, const UnicodeString & Identity,
  bool Mask)
{
  UnicodeString TempDir;
  do
  {
    TempDir = BaseDir.IsEmpty() ? SystemTemporaryDirectory() : BaseDir;
    TempDir = ::IncludeTrailingBackslash(TempDir) + Identity;
    if (Mask)
    {
      TempDir += L"?????";
    }
    else
    {
#if defined(__BORLANDC__)
      TempDir += ::IncludeTrailingBackslash(FormatDateTime(L"nnzzz", Now()));
#else
      TDateTime dt = Now();
      uint16_t H, M, S, MS;
      dt.DecodeTime(H, M, S, MS);
      TempDir += ::IncludeTrailingBackslash(FORMAT(L"%02d%03d", M, MS));
#endif
    }
  }
  while (!Mask && ::DirectoryExists(TempDir));

  return TempDir;
}
开发者ID:gumb0,项目名称:Far-NetBox,代码行数:28,代码来源:GUITools.cpp

示例11: TRec

void TOrdEntryForm::AddRecord()
{
  TRec* PtrRec = new TRec(TR);
  int ItemNum;
  String DateStr;
  String ListStr;
  char buff[80];

  if (TR.Date == BadDate)
    TR.Date = Ovcdate::CurrentDate();
  DateStr = FormatDateTime("mm/dd/yy", StDateToDateTime(TR.Date));
  if (String(TR.Company) == "") {
    sprintf(buff, "%s  %s  %s",
      DateStr.c_str(), String(TR.FirstName).c_str(), String(TR.LastName).c_str());
    ListStr = buff;
  }
  else if (String(TR.FirstName) == "" && String(TR.LastName) == "") {
    sprintf(buff, "%s  %s", DateStr.c_str(), String(TR.Company).c_str());
    ListStr = buff;
  }
  else {
    sprintf(buff, "%s  %s  (%s %s)",
      DateStr.c_str(), String(TR.Company).c_str(),
      String(TR.FirstName).c_str(), String(TR.LastName).c_str());
    ListStr = buff;
  }
  ItemNum = DataList->AddObject(ListStr, reinterpret_cast<TObject*>(PtrRec));
  OvcVirtualListbox1->NumItems = DataList->Count;
  OvcVirtualListbox1->ItemIndex = ItemNum;
  RecState = rsDefault;
}
开发者ID:gzwplato,项目名称:TPOrpheus,代码行数:31,代码来源:OrdNtry1.cpp

示例12: Display

//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::WSocketServer1ClientDisconnect(TObject *Sender,
      TWSocketClient *Client, WORD Error)
{
    Display("Client disconnecting: " + ((TTcpSrvClient *)Client)->PeerAddr + "    " +
            "Duration: " + FormatDateTime("hh:nn:ss",
            Now() - ((TTcpSrvClient *)Client)->ConnectTime));
}
开发者ID:halaszk,项目名称:old-delphi-codes,代码行数:8,代码来源:TcpSrv1.cpp

示例13: _T

BOOL CHwSMTP::SendSubject()
{
	CString csSubject;
	csSubject += _T("Date: ");
	COleDateTime tNow = COleDateTime::GetCurrentTime();
	if ( tNow > 1 )
	{
		csSubject += FormatDateTime (tNow, _T("%a, %d %b %y %H:%M:%S %Z"));
	}
	csSubject += _T("\r\n");
	csSubject += FormatString ( _T("From: %s\r\n"), this->m_csAddrFrom);

	csSubject += FormatString ( _T("CC: %s\r\n"), this->m_StrCC);

	if(m_csSender.IsEmpty())
		m_csSender =  this->m_csAddrFrom;

	csSubject += FormatString ( _T("Sender: %s\r\n"), this->m_csSender);

	if(this->m_csToList.IsEmpty())
		m_csToList = m_csReceiverName;

	csSubject += FormatString ( _T("To: %s\r\n"), this->m_csToList);

	CString m_csToList;

	csSubject += FormatString ( _T("Subject: %s\r\n"), m_csSubject );

	csSubject += FormatString ( _T("X-Mailer: TortoiseGit\r\nMIME-Version: 1.0\r\nContent-Type: %s\r\n\r\n"),
		m_csMIMEContentType );

	return Send ( csSubject );
}
开发者ID:chengn,项目名称:TortoiseGit,代码行数:33,代码来源:HwSMTP.cpp

示例14: OpenLogFile

void TSessionLog::DoAddToSelf(TLogLineType Type, UnicodeString ALine)
{
  if (LogToFile()) { try
  {
    if (FLogger == nullptr)
    {
      OpenLogFile();
    }

    if (FLogger != nullptr)
    {
      UnicodeString Timestamp = FormatDateTime(L" yyyy-mm-dd hh:nn:ss.zzz ", Now());
      UTF8String UtfLine = UTF8String(UnicodeString(LogLineMarks[Type]) + Timestamp + TrimRight(ALine)) + "\r\n";
#if 0
      for (intptr_t Index = 1; Index <= UtfLine.Length(); Index++)
      {
        if ((UtfLine[Index] == '\n') &&
            (UtfLine[Index - 1] != '\r'))
        {
          UtfLine.Insert(L'\r', Index);
        }
      }
#endif // #if 0
      intptr_t ToWrite = UtfLine.Length();
      CheckSize(ToWrite);
      FCurrentFileSize += FLogger->Write(UtfLine.c_str(), ToWrite);
    }}
    catch (...)
    {
      // TODO: log error
      DEBUG_PRINTF("TSessionLog::DoAddToSelf: error");
    }
  }
}
开发者ID:michaellukashov,项目名称:Far-NetBox,代码行数:34,代码来源:SessionInfo.cpp

示例15: NameThreadForDebugging

//---------------------------------------------------------------------------
void __fastcall DB_Loading::Execute()
{
	NameThreadForDebugging("TH_DB_Loading");

	DBManager->ALDB_Connect();
	DBManager->CADB_Connect();
	//---- Place thread code here ----
	while(stkc_frm->run == true)
	{
		try
		{
	               	stkc_frm->STK_SRVinfo.SRV_NOWDATE = FormatDateTime("MM/DD/YY", Now());;
			stkc_frm->STK_SRVinfo.SRV_NOWTIME = Time().TimeString();

			DBManager->Alarm_List_Load();
			DBManager->GetAllCarrierinfo();
			Sleep(300);
		}
		catch(Exception *e)
		{


		}

    }


}
开发者ID:il-young,项目名称:visionsemicon,代码行数:29,代码来源:THDB_Loading.cpp


注:本文中的FormatDateTime函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。