本文整理汇总了C++中CData::GetSysTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CData::GetSysTime方法的具体用法?C++ CData::GetSysTime怎么用?C++ CData::GetSysTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CData
的用法示例。
在下文中一共展示了CData::GetSysTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SMT_GetCurrFileName
/*=================================================================
* Function ID : SMT_GetCurrFileName
* Input : void
* Output : void
* Author :
* Date : 2006 2
* Return : void
* Description : 获取当前文件
* Notice :
*=================================================================*/
bool CSmartCommunicationDlg::SMT_GetCurrFileName(char* cCurFileName,char* sBakFileName)
{
char sCurFileName[256];
char FileName[256];
CMyLog cLog;
CData cData;
memset(sCurFileName,0,sizeof sCurFileName);
memset(FileName,0,sizeof FileName);
strcpy(sBakFileName,m_DealPath);
strcat(sBakFileName,"\\Bak\\Bak_");
memcpy(sBakFileName+strlen(sBakFileName),cData.GetSysTime(),8);
strcat(sBakFileName,"_DealData.txt");
strcpy(FileName,m_DealPath);
strcat(FileName,"\\");
memcpy(FileName+strlen(FileName),cData.GetSysTime(),8);
strcat(FileName,"_DealData");
strcpy(sCurFileName,FileName);
strcat(sCurFileName,".txt");
if( cData.FileIsExist(sCurFileName) )
{
if( rename(sCurFileName,FileName)>=0 )
{
strcpy(cCurFileName,FileName);
return true;
}
}
return false;
}
示例2: CheckIsChangeYear
/*=================================================================
* Function ID : CheckIsChangeYear
* Input : char* cpath
* Output : void
* Author : DengJun
* Date : Apr 2005
* Return : void
* Description :
* Notice : 检查是否已经是新的一年开始
* : cpath-->路径
*=================================================================*/
void CMyLog::CheckIsChangeYear(char* cpath)
{
char oldPath[256],cyear[16];
char NewPath[256];
int len=0;
CData mData;
memset(cyear, 0x00,sizeof cyear);
memset(oldPath,0x00,sizeof oldPath);
memset(NewPath,0x00,sizeof NewPath);
memcpy(cyear,mData.GetSysTime(),6);
strcpy(oldPath,cpath);
len=strlen(cpath);
if( !len ) return ;
while( len--)
{
if( cpath[len]=='\\')
{
if( memcmp(cpath+len-6,cyear,6) )
{
memcpy(NewPath,cpath,len-6);
strcat(NewPath,cyear);
CreateDirectory(NewPath,NULL);
memcpy(cpath+len-6,cyear,6);
}
break;
}
}
}
示例3: Init
bool CSmartCommunicationDlg::Init()
{
char CurPath[256],CreatePath[256],CurDate[30];
CData mData;
char buf[128],str[8];
FileBase mfile;
DWORD nTime=0;
int nLen=0;
memset(g_sCommRec, 0,sizeof g_sCommRec);
memset(&g_IniFilePara, 0,sizeof g_IniFilePara);
memset(g_PathIniFileName, 0,sizeof g_PathIniFileName);
memset(g_SaveBlackList, 0,sizeof g_SaveBlackList);
memset(g_SaveAssistantList,0,sizeof g_SaveAssistantList);
memset(str, 0x00,sizeof str);
memset(CurDate, 0x00,sizeof CurDate);
memset(m_DealPath, 0x00,sizeof m_DealPath);
memset(CurPath, 0x00,sizeof CurPath);
memset(CreatePath, 0x00,sizeof CreatePath);
memset(m_ErrMsg, 0x00,sizeof m_ErrMsg);
memset(m_CurPath, 0x00,sizeof m_CurPath);
strcpy(CurPath,mData.GetCurPath());
memcpy(CurDate,mData.GetSysTime(),6);
g_nSaveAssistantVer=0;
g_WriteFileLock =false; //文件锁
g_VLinkIP.clear();
strcpy(g_sCommRec,CurPath);
strcat(g_sCommRec,"\\SmartCommRec.ini");
//上传交易数据明细
strcpy(m_DealPath,CurPath);
strcat(m_DealPath,"\\Deal");
CreateDirectory(m_DealPath,NULL);
strcpy(g_PathIniFileName,CurPath);
strcat(g_PathIniFileName,"\\system.ini");
//日志路径
memset(CreatePath,0x00,sizeof CreatePath);
strcpy(CreatePath,CurPath);
strcat(CreatePath,"\\Log");
CreateDirectory(CreatePath,NULL);
strcat(CreatePath,"\\");
strcat(CreatePath,CurDate);
CreateDirectory(CreatePath,NULL);
strcpy(m_CurPath,CreatePath);
//系统日志
strcat(CreatePath,"\\Sys");
CreateDirectory(CreatePath,NULL);
if( !g_VSmartPos.empty()) g_VSmartPos.clear();
if( !g_LTcpsmart.empty()) g_LTcpsmart.clear();
nRateDeveice = 0;
m_BtRate.EnableWindow(FALSE);
m_edit_devicetotal.SetWindowText("");
m_edit_devicerate.SetWindowText("");
m_edit_devicesuccess.SetWindowText("");
//延时时间1
memset(buf,0,sizeof buf);
mfile.GetProfileStr("system.ini","SLEEP","TIME1",buf);
mData.trim(buf);
if( !strlen(buf) ) SMT_WAITFORTIME1=35;
else SMT_WAITFORTIME1=atol(buf);
//延时时间2
memset(buf,0,sizeof buf);
mfile.GetProfileStr("system.ini","SLEEP","TIME2",buf);
mData.trim(buf);
if( !strlen(buf) ) SMT_WAITFORTIME2=25;
else SMT_WAITFORTIME2=atol(buf);
//延时时间3
memset(buf,0,sizeof buf);
mfile.GetProfileStr("system.ini","SLEEP","TIME3",buf);
mData.trim(buf);
if( !strlen(buf) ) SMT_WAITFORTIME3=350;
else SMT_WAITFORTIME3=atol(buf);
//调试日志开关
memset(buf,0,sizeof buf);
mfile.GetProfileStr("system.ini","SLEEP","LOG",buf);
mData.trim(buf);
if( !strlen(buf) ) g_IniFilePara.bWriteDebugLog=false;
else g_IniFilePara.bWriteDebugLog=true;
memset(buf,0,sizeof buf);
mfile.GetProfileStr("system.ini","MONEY","MAX",buf);
mData.trim(buf);
//记录上传的时间间隔
memset(buf,0,sizeof buf);
mfile.GetProfileStr("system.ini","SLEEP","UPRECORD",buf);
mData.trim(buf);
g_IniFilePara.lUpRecordWaitTime=atol(buf);
if( g_IniFilePara.lUpRecordWaitTime<=0 )
//.........这里部分代码省略.........
示例4: SMT_StartUpRecordThread
UINT SMT_StartUpRecordThread( LPVOID pParam )
{
char sErrMsg[256];
char sBakPath[256];
char sYearMonth[20];
XDHANDLE nHandler=NULL;
CData cData;
memset(sErrMsg, 0,sizeof sErrMsg);
memset(sBakPath, 0,sizeof sBakPath);
memset(sYearMonth,0,sizeof sYearMonth);
//创建记录源文件备份的目录
strcpy(sBakPath,((CSmartCommunicationDlg*)pParam)->m_DealPath);
strcat(sBakPath,"\\Bak");
CreateDirectory(sBakPath,NULL);
try
{
To_Start:
//从连接池中获取一个连接
while(g_StartFlag )
{
if( (nHandler=g_CInterface.SMT_GetXDHandleRecorder())!=NULL) break;
Sleep(1000);
}
memset(sErrMsg, 0,sizeof sErrMsg );
memset(sYearMonth,0,sizeof sYearMonth);
//查询上月是否还有数据文件,若有则移到上传目录下
memcpy(sErrMsg,cData.GetSysTime(),6);
sprintf(sYearMonth,"%ld",atol(sErrMsg)-1);
((CSmartCommunicationDlg*)pParam)->SMT_ChnagLinkFileToUpFile(sYearMonth);
while(g_StartFlag )
{
//定时上传记录到金仕达
if(! ((CSmartCommunicationDlg*)pParam)->SMT_UpBeforeFile(nHandler) )
{
Sleep(500);
if( !g_CInterface.m_bConnectStatus )
{
g_CInterface.SMT_SetXDHandleFree(nHandler);
goto To_Start;
}
}
memset(sYearMonth,0,sizeof sYearMonth);
memcpy(sYearMonth,cData.GetSysTime(),6);
//定时将各个链路产生的数据文件进行转移到上传记录的目录下
if( !((CSmartCommunicationDlg*)pParam)->SMT_ChnagLinkFileToUpFile(sYearMonth) )
{
//每半分钟查询一下是否有需要上传的文件记录
for( int i=0; i<5*5; i++ )
{
Sleep(g_IniFilePara.lUpRecordWaitTime/5);
if( !g_StartFlag ) break;
}
}
}
}
catch (...)
{
memset(sErrMsg,0,sizeof sErrMsg);
strcpy(sErrMsg,"上传交易记录的线程异常,前置停止运行");
((CSmartCommunicationDlg*)pParam)->WriteLog(sErrMsg);
((CSmartCommunicationDlg*)pParam)->OnButtonStop();
MessageBox(NULL,sErrMsg,"严重警告",MB_OK);
}
return 0;
}