[twsocket] ICS Ras and Duration of use

Bob Herbst bherbst@ezo.net
Fri, 23 Jun 2000 01:49:32 -0400


Steve,
I am confused by your remark in your reply about what Francois was trying to
say.

Francois has  in his program that is downloaded from his ICS site in
rasdial.zip, a format statement which you recommend not using. I have copied
from his original.
...........................
   else
        DurationLabel.Caption := '';

    DurationLabel.Caption := 'Total: ' + DurationLabel.Caption +
                             TimeToStr(Frac(Duration));
    IniFile.Free;
end;
..........................................

And his original does output as a Time of Day   Total:   12:00:00 AM

So as a revision I wrote what was as shown below . And the output
 TimeUsed: 0:15:3

And now there is your suggestion, also shown below, which I  have
incorporated into my revision and it displays the duration in more familiar
terms.   Time Used: 00:02:08

Since I am unfamiliar with the notation in your answer 'Time Used:
%.2d:%.2d:%.2d' what is the maximum time that it will display?

I still am confused about what he was trying to say.
Bob H

-----Original Message-----
From: Stephen Williams <SWilliams@fm.optus.net.au>
To: 'twsocket@elists.org' <twsocket@elists.org>
Date: Thursday, June 22, 2000 7:09 PM
Subject: RE: [twsocket] ICS Ras and Duration of use


>What he's getting at is that you should not use the TimeToStr function for
>an elapsed time display.  TimeToStr gives you the time of day, resulting in
>the 12:00AM for zero minutes elapsed.  A time elapsed display should start
>at 00:00, with no regard for the regional settings.
>
>I would suggest the following to format the display better.
>
>  DecodeTime(Duration, Hour, Min, Sec, Msec);
>  DurationLabel.Caption := Format('Time Used: %.2d:%.2d:%.2d',
>    [Hour, Min, Sec]);
>
>This will show as
>
>  Time Used: 00:02:08
>
>For a simpler display, drop the seconds from the output.
>
>Steve 'Sly' Williams
>IT Development
>Cable & Wireless Optus Outsourcing Services
>swilliams@fm.optus.net.au
>------------------------------------------------------------
>"Programming is an art form that fights back." -Unknown
>------------------------------------------------------------
>
>> As far as I remember, time display with Delphi function use
>> the format you
>> defined in your control panel.
>> --
>> francois.piette@swing.be
>> http://users.swing.be/francois.piette/indexuk.htm
>>
>> > Hi
>> > I have Win98 and D4
>> > The ICS Ras as delivered has a time display  from the
>> variable Duration.
>> > When a run is executed the time for use is displayed  as
>> 12:00:00 AM and
>> > after a 15 minute 3 second use  the time is displayed as 12:15:03 AM
>> > I submit the following revision the procedure
>> >
>> > procedure TRasDialerForm.GetDuration;
>> > var
>> >   Hour, Min, Sec, Msec: Word;
>> > .......
>> >   Section, TimeStr: string;
>> > begin
>> > ........
>> >
>> >   DecodeTime(Duration, Hour, Min, Sec, Msec);
>> >   TimeSTr := IntToStr(Hour) + ':' + IntToStr(Min) + ':' +
>> IntToStr(Sec);
>> >   DurationLabel.Caption := 'TimeUsed: ' + TimeStr;
>> > ........
>> >
>> > end;
>> >
>> > The revision makes the display of time used show
>> > TimeUsed: 0:15:3
>> >
>> > Comments appreciated.
>> >
>> > Bob H
>
>_______________________________________________
>TWSocket mailing list [http://elists.org/mailman/listinfo/twsocket]
>Visit our website at http://www.rtfm.be/fpiette/indexuk.htm
>