#include<stdio.h>
#include<sys/timeb.h>
CString file_path = L"C:\\HHTmp\\DicomTmp\\send.txt";
CTime Tm=CTime::GetCurrentTime();
int nYear,nMonth,nDay,nHour,nMinute,nSecond,nMinSecond;
CString g_szDateTime;
nYear=Tm.GetYear();
nMonth=Tm.GetMonth();
nDay=Tm.GetDay();
nHour=Tm.GetHour();
nMinute=Tm.GetMinute();
nSecond=Tm.GetSecond();
CString mSecond;
struct _timeb timebuffer1;
_ftime(&timebuffer1);
mSecond.Format(_T("%d"),timebuffer1.millitm);
nMinSecond=_wtoi(mSecond);
g_szDateTime.Format(_T("下start%04d/%02d/%02d/%02d:%02d:%02d:%3d"),nYear,nMonth,nDay,nHour,
nMinute,nSecond,nMinSecond);
{
CFile file(file_path,CFile::modeReadWrite|CFile::modeCreate|CFile::modeNoTruncate);
CString str = L"\r\n";
file.SeekToEnd();
file.Write(g_szDateTime.GetBuffer(),g_szDateTime.GetLength()*sizeof(TCHAR));
file.Write(str.GetBuffer(),str.GetLength()*sizeof(TCHAR));
file.Close();
}
m_printView->TurnPage(WM_PrintNextPage);
CTime Tm1=CTime::GetCurrentTime();
nYear=Tm1.GetYear();
nMonth=Tm1.GetMonth();
nDay=Tm1.GetDay();
nHour=Tm1.GetHour();
nMinute=Tm1.GetMinute();
nSecond=Tm1.GetSecond();
struct _timeb timebuffer2;
_ftime(&timebuffer2);
mSecond.Format(_T("%d"),timebuffer2.millitm);
nMinSecond=_wtoi(mSecond);
g_szDateTime.Format(_T("下end%04d/%02d/%02d/%02d:%02d:%02d:%3d"),nYear,nMonth,nDay,nHour,
nMinute,nSecond,nMinSecond);
{
CFile file(file_path,CFile::modeReadWrite|CFile::modeCreate|CFile::modeNoTruncate);
CString str = L"\r\n";
file1.SeekToEnd();
file1.Write(g_szDateTime.GetBuffer(),g_szDateTime.GetLength()*sizeof(TCHAR));
file1.Write(str.GetBuffer(),str.GetLength()*sizeof(TCHAR));
file1.Close();
}
增加带有毫秒的日志log
最新推荐文章于 2024-07-19 03:56:13 发布