|
-
Nov 27th, 2000, 08:48 AM
#1
Thread Starter
Member
Hi, in my program i want to get the current time as soon as
the program starts to run a batch process and again when it
finishes running the batch process.
that part is no problem
what i can't seem to do is calculate how long the process
took using the two stored times.
how do you do this?
thanks in advance
MICK
-
Nov 27th, 2000, 09:08 AM
#2
Fanatic Member
How long of a time interval are you expecting ?
You can use DateDiff to return the elapsed seconds.
Code:
Private Sub Command1_Click()
Dim startTime As Date
Dim finishTime As Date
Dim elapsed As Long
Dim x As Long
startTime = Now
For x = 1 To 100000000
'Do whatever
Next x
finishTime = Now
elapsed = DateDiff("s", startTime, finishTime)
MsgBox startTime & vbCrLf & finishTime & vbCrLf & elapsed & " seconds passed"
End Sub
If you need something more accurate, use the GetTickCount API to get the milliseconds that have passed.
Look here http://forums.vb-world.net/showthrea...threadid=39963 for a few other ideas.
[Edited by jbart on 11-27-2000 at 09:11 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|