Diddy Kong
2010-03-19 21:26:08
When I use GetSystemTime I get the wrong time.
2010-03-19 21:26:08
2010-03-19 21:33:58
From: Diddy Kong
When I use GetSystemTime I get the wrong time.
Starting
52966000 // 1 second?
Successfully executed.
2010-03-19 21:37:08
2010-03-19 21:39:35
begin
MarkTime(TimeRunning1);
....
If ... then
Writeln(' Ran for ' + IntToStr(TimeFromMark(TimeRunning1)));
end.
2010-03-19 21:45:48
2010-03-19 22:56:08
2010-03-20 00:20:56
2010-03-20 02:16:51
From: Diddy Kong
When I use GetSystemTime I get the wrong time.
2010-03-20 07:33:00
writeln(GetTimeRunning);
2010-03-20 08:58:22
program new;
function LocalTime : String;
var
S, M, H, Mil : Integer;
StrResult : String;
begin
Mil := GetSystemTime
H := Floor(Mil / 1000 / 60 / 60)
Mil := Mil - H * 60 * 60 * 1000
M := Floor(Mil / 1000 / 60)
Mil := Mil - M * 60 * 1000
S := Floor(Mil / 1000)
Mil := Mil - S * 1000
if 10 > H then
StrResult := '0' + IntToStr(H) + ':'
else
StrResult := IntToStr(H) + ':';
if 10 > M then
StrResult := StrResult + '0' + IntToStr(M) + ':'
else
StrResult := StrResult + IntToStr(M) + ':';
if 10 > S then
StrResult := StrResult + '0' + IntToStr(S) + '.'
else
StrResult := StrResult + IntToStr(S) + '.';
case Length(IntToStr(Mil)) of
1 : StrResult := StrResult + '000' + IntToStr(Mil);
2 : StrResult := StrResult + '00' + IntToStr(Mil);
3 : StrResult := StrResult + '0' + IntToStr(Mil);
end;
Result := '[' + StrResult + '] '
end;
begin
While True do
begin
Writeln(LocalTime)
Wait(315);
end;
end.
2010-03-20 08:59:46
2010-03-20 09:03:08
Writeln(LocalTime)
Writeln(GetTimeRunning)00:11:05.0141
1670
00:11:05.0469
1982
00:11:05.0796
2309
00:11:06.0124
2637
Successfully executed.2010-03-20 09:50:59
{*******************************************************************************
function TheTime : string;
By: RsN (fixed by Ron)
Description: Returns current time as a string
*******************************************************************************}
function TheTime: string;
var
Hour, Mins, Sec, MSec: Word;
PAM: string;
begin
DecodeTime(Now, Hour, Mins, Sec, MSec);
PAM := 'AM';
if (Hour > 12) then
begin
Hour := Hour - 12;
PAM := 'PM';
end else if (Hour = 12) then
PAM := 'PM'
else if (Hour = 0) then
Hour := 12;
Result := (Padz(IntToStr(Hour), 2) + ':' + Padz(IntToStr(Mins), 2) + ':' + Padz(IntToStr(Sec), 2) + ' ' + PAM);
end;
{*******************************************************************************
function TheDate(DateFormat : Integer) : String;
By: Ron, Nava2 & Narcle
Description: TheDate will return the current date. DateFormats can be...
Date_Formal = April 2nd, 2007 Month Day, Year
Date_Month = 04/02/07 Month/Day/Year
Date_Day = 02-04-07 Day-Month-Year
*******************************************************************************}
function TheDate(DateFormat: Integer): string;
var
Year, Month, Day: Word;
D: string;
Mnths, sfx: TStringArray;
begin
DecodeDate(Date, Year, Month, Day);
Mnths := ['January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December'];
sfx := ['st', 'nd', 'rd'];
case DateFormat of
1:
begin
if InRange(Day mod 10, 1, 3) and not InRange(Day, 11, 13) then
D := sfx[(Day mod 10)-1]
else
D := 'th';
Result := Mnths[Month - 1] + ' ' + IntToStr(Day) + D +', ' + IntToStr(Year);
end;
2: Result := Padz(IntToStr(Month), 2) + '/' + Padz(IntToStr(Day), 2) + '/' + Copy(IntToStr(Year), 3, 4);
3: Result := Padz(IntToStr(Day), 2) + '-' + Padz(IntToStr(Month), 2) + '-' + Copy(IntToStr(Year), 3, 4);
else
srl_Warn('TheDate', 'DateFormat can only be 1, 2, or 3!', warn_AllVersions);
end;
end;