PCALCINFO stData = {0};
char ppChar[64];
strftime( ppChar, sizeof(ppChar), " %Y-%m-%d %X" , localtime(&stData.m_pSubsection[i].m_time) );
strText2.Format("分笔数据,时间:%s",ppChar);
分笔数据时间为何不正确?
你地代码贴的不全,此外你也把不全的分笔数据的日志贴过来我们看看
void CMainWindowDlg::OnButton1Gedata()
{
//读取上海市场的600000日线数据范例
PCALCINFO stData = {0};
stData.m_dataType = TICK_DATA ; //MIN1_DATA ; //DAY_DATA;//日线
stData.m_bIsPow = 1; //是否复权
stData.m_wMarket = 'HS';
strcpy(stData.m_szLabel,"600030"); //读取600000 浦发银行数据
char dest[20]={0};
const char format[]="%A, %B %d %Y. The time is %X";
if(g_pMainFormework->GetDataInfo(&stData))
{
CString strText,strText2,strTextAll;
GetDlgItemText(IDC_EDIT_INFO, strTextAll);
char ppChar[64];
for(int i = 0; i < stData.m_nNumSubData; i++)
{
strftime( ppChar, sizeof(ppChar), " %Y-%m-%d %X" , localtime(&stData.m_pSubsection[i].m_time) );
strText2.Format("分笔数据,时间:%s",&ppChar);
strText.Format("分笔数据,m_fNewPrice:%f,m_fVolume:%f,m_fAmount:%f",stData.m_pSubsection[i].m_fNewPrice,
stData.m_pSubsection[i].m_fVolume,stData.m_pSubsection[i].m_fAmount);
strTextAll += ":::" + strText2 + ";;;" + strText + "\r\n";
}
strText.Format("共取到%d个数据",stData.m_nNumData);
strTextAll += strText + "\r\n";
SetDlgItemText(IDC_EDIT_INFO, strTextAll);
}
以下运行的结果:除了时间不对,价格,成交量,好像都不对。
:::分笔数据,时间: 2004-08-19 09:18:56;;;分笔数据,m_fNewPrice:0.000000,m_fVolume:341131392.000000,m_fAmount:0.000000
:::分笔数据,时间: 2004-08-19 09:18:56;;;分笔数据,m_fNewPrice:10.260000,m_fVolume:0.000000,m_fAmount:333776.000000
:::分笔数据,时间: 1972-04-11 16:11:46;;;分笔数据,m_fNewPrice:-0.000000,m_fVolume:10.260000,m_fAmount:10.250000
:::分笔数据,时间: 2008-08-13 23:18:24;;;分笔数据,m_fNewPrice:341205792.000000,m_fVolume:-0.000000,m_fAmount:10.250000
:::分笔数据,时间: 2004-08-19 12:13:42;;;分笔数据,m_fNewPrice:0.000000,m_fVolume:341219200.000000,m_fAmount:0.000000
:::分笔数据,时间: 2004-08-19 09:18:56;;;分笔数据,m_fNewPrice:10.260000,m_fVolume:0.000000,m_fAmount:333813.000000
共取到1001个数据
/* time_t在金字塔的定义是32位,对于使用VS2005等高版本Visual C++,time_t是64位,直接使用将导致数据结构紊乱
请在stdafx.h文件里加上如下这个定义即可。#define _USE_32BIT_TIME_T */
还有我比较了一下金字塔的实时分笔数据,和通达信的差很多,不知道哪个准确,比如:600030
你把你的工程文件,删除编译的中间文件后,压缩一下上传论坛吧,我们这边调试一下帮你看看问题