Re: TZF - A question regard the TimeDate unit

[email protected]
Newsgroups gmane.comp.lang.delphi.topaz
Message-ID <[email protected]>
[email protected] schrieb:
Hi,

you can find a great free unit with a lot of calculation of Date/Time
under
http://www.esbconsult.com.au/
we use it for many times and it is great. Try it!!

Guenter



> I've been using the TimeDiff function included in the
> Topaz timedate.pas 
> unit, and it works great.  Now I need a bit of extended
> capability, and 
> am not quite sure how to proceed, so thought I'd ask
> here.
> 
> I'm doing some performance benchmarks for the boss, and
> with each 
> iteration of the loop I'm checking the elapsed time of
> the current loop 
> against a sMinVal and sMaxVal, which then lists to the
> screen the 
> minimum and maximum times a loop took.  Something Like
> this:
> 
> sMax       : TimeType;
> sMin       : TimeType;
> sLoopStart : TimeType;
> sElapsed   : TimeType;
> 
> sMax := '00:00:00';
> sMin := '00:60:00';
> 
> while blLoop do
> begin
>   sLoopStart := SystemTime();
> 
>   // do the loop processing here
> 
>   sLoopEnd := SystemTime();
> 
>   sElasped := TimeDiff(SystemTime(), sLoopStart);
> 
>   if InSeconds(sElapsed) > InSeconds(sMax) then
>     sMax := sElapsed;
> 
>   if InSeconds(sElapsed) < InSeconds(sMin) then
>     sMin := sElapsed;
> end;
> 
> Now what I'd like to do is also record or display the
> Average time.  
> WHat would be the best way to do this?  I know how to get
> the average of 
> a sequence of numbers, but I'm not exactly sure how to
> translate that to 
> times.
> 
> I had considered taking the current elapsed time,
> converting it with 
> InSeconds(), then adding that number to a variable that
> holds the sum of 
> all the InSecond() conversions, the divide that by the
> number of loops.  
> But I'm not sure how to translate that number back into a
> TimeType 
> string for displaying.
> 
> Thanx!
> 
> 
>

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]

TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
==^================================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.