0
0000000$
Unregistered / Unconfirmed
GUEST, unregistred user!
function ctime:longword;
const
Days : array [1..12] of integer = (31,28,31,30,31,30,31,31,30,31,30,31);
baseyear:integer = 1970;
//time 从 1970-1-1 00:00:00 开始计时
var
year,month,day,hour,Minutes,second,MilliSecond:word;
totalseconds,totaldays:longword;
begin
//get current date time
decodedatetime(now,year,month,day,hour,Minutes,second,MilliSecond);
if (year < baseyear) then
begin
result := 0;
exit;
end;
totaldays := daysbetween(now,strtodatetime('1970-01-01'));
//view Note.
//add hours
totalseconds := totaldays * 24 + hour - 8;
// -8 , because delphi's now function begin
9:00 am
//add minutes
totalseconds := totalseconds*60 + Minutes ;
//add seconds
totalseconds := totalseconds*60 + second;
//return value
result := totalseconds;
end;
const
Days : array [1..12] of integer = (31,28,31,30,31,30,31,31,30,31,30,31);
baseyear:integer = 1970;
//time 从 1970-1-1 00:00:00 开始计时
var
year,month,day,hour,Minutes,second,MilliSecond:word;
totalseconds,totaldays:longword;
begin
//get current date time
decodedatetime(now,year,month,day,hour,Minutes,second,MilliSecond);
if (year < baseyear) then
begin
result := 0;
exit;
end;
totaldays := daysbetween(now,strtodatetime('1970-01-01'));
//view Note.
//add hours
totalseconds := totaldays * 24 + hour - 8;
// -8 , because delphi's now function begin
9:00 am
//add minutes
totalseconds := totalseconds*60 + Minutes ;
//add seconds
totalseconds := totalseconds*60 + second;
//return value
result := totalseconds;
end;