我突然想到了一个获时间的方法?!不知道可行不!?
#include "web_api.h"
typedef long time_t;
Action()
{
time_t NtimeS;
time_t NtimeE;
time_t NNow;
web_url("www.baidu.com",
"URL=http://www.baidu.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);
NtimeS=time(&NtimeS);
// lr_output_message("%d",time(&NtimeS));
lr_start_transaction("搜索字符");
web_submit_form("s",
"Snapshot=t3.inf",
ITEMDATA,
"Name=wd", "Value=love", ENDITEM,
LAST);
web_url("s_2",
"URL=http://www.baidu.com/s?wd=love&cl=3&tn=jkanh_pg",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t4.inf",
"Mode=HTML",
LAST);
NtimeE=time(&NtimeE);
web_url("getadv.php",
"URL=http://client.webbrowser.smartpv.cn:1207/getadv.php?fid=7054&kid=3006&cnt=1&mac=00-1D-60-20-63-B4&kw=love&version=3.1.5",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t5.inf",
"Mode=HTML",
LAST);
lr_end_transaction("搜索字符", LR_AUTO);
NNow=NtimeE-NtimeS;
// lr_output_message("%d",time(&NtimeS));
lr_message("Formatted time and date: %d", NNow);
lr_message("Formatted time and date: %s", ctime(&NtimeS));
lr_message("Formatted time and date: %s", ctime(&NtimeE));
return 0;
}
这样和加入事务应该没有什么不同的,如果运行时间长的话,再求下平均值也不会差很多的!不知道我的想法对不?如果能从服务器那获取响应时间会更好的!