用delphi转换c时间函数
C代码如下所示用delphi转换c时间函数,c,delphi,typeconverter,C,Delphi,Typeconverter,C代码如下所示 clock_t clock_start, clock_end; clock_start = clock(); if ((pass = create_pass(100, time(NULL))) == NULL) crate_pass_err("passerror"); 这里的时间是几点 我喜欢德尔福 function create_pass(sz:DWORD;Sd:DWORD):Pointer;stdcall;external DL
clock_t clock_start, clock_end;
clock_start = clock();
if ((pass = create_pass(100, time(NULL))) == NULL)
crate_pass_err("passerror");
这里的时间是几点
我喜欢德尔福
function create_pass(sz:DWORD;Sd:DWORD):Pointer;stdcall;external DLL;
start:=gettickcount;
DecodeTime(now, hours, mins, secs, milliSecs);
timeread:= strtoint(FormatDateTime('NNSSZZZ',time));
pass:=create_pass(100,timeread); // timeread or millisecs or start ?
以下哪项会给出相同的结果?还是有其他解决办法
编辑:我在程序输出中得到的结果并不完全相同。在c代码中,时间到底在做什么?我正在努力找到它。
c代码输出:stacksample,delphi代码输出%Oê^%O
我正在尝试将我的密码程序转换为Delphi是一个C函数,它通常返回自Unix时代(1970年1月1日00:00 UTC)以来经过的秒数,我说这通常是因为时间实际返回的值不受C标准的约束,但大多数实现都是这样做的
您所展示的C代码的Delphi翻译如下:
使用
…,DateUtils;
变量
时钟开始,时钟结束:DWORD;
开始
...
时钟启动:=GetTickCount;
通过:=create_pass100,DWORDDateTimeToUnixNow,False;
如果pass=nil,则
板条箱“过路人”的错误;
...
时钟结束:=GetTickCount;
...
终止
是一个C函数,它通常返回自Unix纪元(1970年1月1日UTC 00:00)以来经过的秒数,我通常这样说是因为时间实际返回的值不是C标准要求的,但大多数实现都是这样做的
您所展示的C代码的Delphi翻译如下:
使用
…,DateUtils;
变量
时钟开始,时钟结束:DWORD;
开始
...
时钟启动:=GetTickCount;
通过:=create_pass100,DWORDDateTimeToUnixNow,False;
如果pass=nil,则
板条箱“过路人”的错误;
...
时钟结束:=GetTickCount;
...
终止