的功能我用下面的C代码(Linux操作系统Ubuntu),以每5分钟采样代理服务器,并得到了买入价和卖出价值:ç-language停靠在指定的时间
int main(int argc, char *argv[])
{
struct stock myStock;
struct stock *myStock_ptr;
struct timeval t;
time_t timeNow;
strcpy(myStock.exchange,"MI");
strcpy(myStock.market,"EQCON");
strcpy(myStock.t3Id,"1");
strcpy(myStock.subscLabel,"");
strcpy(myStock.status,"0");
strcpy(myStock.ask,"");
strcpy(myStock.bid,"");
buildSubLabel(&myStock);
while (1) {
t.tv_sec = 1;
t.tv_usec = 0;
select(0, NULL, NULL, NULL, &t);
time(&timeNow);
sample(&myStock);
printf("DataLink on %s\n",myStock.subscLabel);
printf("Time Now: --- %s",ctime(&timeNow));
printf("DataLink Status---- %s\n",myStock.status);
printf("Ask --- %s\n",myStock.ask);
printf("Bid --- %s\n",myStock.bid);
printf("###################\n");
}
return 0;
}
我”什么m不能做的是在特定时间安排样本功能。 我想打电话样本函数在 9.01首次 9.05第二时间 9.10第三时间 9.15 ...... 9.20 ...... ,以此类推,直到17.30 后17.30这个过程应该终止。
问候 马西莫
我不确定你的最终目标,但更容易做的事情是运行cron作业。 Cron只是一个安排程序在特定时间运行的工具。您可以设置它在一天中的特定时段每五分钟运行一次程序。请参阅https://help.ubuntu.com/community/CronHowto。 – bchurchill 2012-07-25 16:57:36