Subject | Re: [ib-support] 'Time manipulation' or 'The Vulcan Science Directorate says it impossible' |
---|---|
Author | Greg Peterson |
Post date | 2002-09-19T00:46:26Z |
I always use the smallest unit of interest stored in an Integer (Or Int64 if
need be)
If a process take 3 hours 14 minutes and 22 second then I'd store it as:
ProcessTime := 22 + (14*60) + (3 *3600).
You, of course, have to extract the H:M:S from the ProcessTime when you're
going to display it.
Procedure ExtractHMS (Var H : Integer; var M : Integer; var S : Integer;
ProcessTime : Integer);
begin
H := ProcessTime DIV 3600;
ProcessTime := ProcessTime - (H*3600);
M := ProcessTime DIV 60;
ProcessTime := ProcessTime - (M*60);
S := ProcessTime; // what ever is left over
end;
Hope this helps -- Greg
need be)
If a process take 3 hours 14 minutes and 22 second then I'd store it as:
ProcessTime := 22 + (14*60) + (3 *3600).
You, of course, have to extract the H:M:S from the ProcessTime when you're
going to display it.
Procedure ExtractHMS (Var H : Integer; var M : Integer; var S : Integer;
ProcessTime : Integer);
begin
H := ProcessTime DIV 3600;
ProcessTime := ProcessTime - (H*3600);
M := ProcessTime DIV 60;
ProcessTime := ProcessTime - (M*60);
S := ProcessTime; // what ever is left over
end;
Hope this helps -- Greg