Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Compute Hours, Minutes, Seconds from SECONDS()
Message
From
08/09/1999 02:01:26
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00261364
Message ID:
00262281
Views:
15
>>Anybody have a technique for measuring the amount of time it takes a function to process?
>>
>>I tried the following ... but that give me total seconds and I need the that result converted to hours:minutes:seconds.
>>
>>Other Suggestions? Ideas?
>>
>>nStart = Seconds()
>>.
>>(my code)
>>.
>>
>>nStop = Seconds()
>>
>>nRunTime = nStop-nStart
>>
>>How to get nRunTime to look like HH:MM:SS??
>>
>>Help?
>>
>>Please and thanks.
>
>
>? TTOC(DTOT(DATE())+nRunTime,2)

Practically could fit.
But apart from 12/24 hours setting, it's "set seconds" dependable. If process lasts more than 24 hours, the biggest value you could get would be 23:59:59.
* Assuming up to 99:59:59
? padl(int(nRuntime/3600),2,"0")+":"+;
  padl(int(nRuntime%3600/60),2,"0")+":"+;
  padl(nRuntime%60,6,"0")

* Or no milliseconds is needed
? padl(int(nRuntime/3600),2,"0")+":"+;
  padl(int(nRuntime%3600/60),2,"0")+":"+;
  padl(int(nRuntime%60),2,"0")
OTOH, your TTOC(,2) is a nice way to get time input from user :) Actually I use it combined with a time entry textbox + datetimepicker ActiveX. At textbox gotfocus, textbox sets itself to visible=.f. and sets focus to ActiveX (visible=.t.). That in turn sets textbox value to ttoc(,2) and visible=.t. at lostfocus (activex.visible=.f.). As if it were a Sparse=.t. control in a grid.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform