Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Sep 19, 2019 8:30 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Application - Elapsed Time
PostPosted: Sun Nov 27, 2011 9:26 am 
Offline
User avatar

Joined: Sat May 27, 2006 3:27 pm
Posts: 480
Hello i have a method i made to get the elapsed time it takes to complete a task. I hope this helps anyone that wants to time a task!

1. Make 6 global Dates name them

EndHours,EndMinutes,EndSeconds,StartHours,StartSeconds,StartMinutes

2. Make a Timer and name it ElapsedTimer and set its period to 1000 = 1sec And Set the Mode = Off

3. Make a method name it ElapsedTime

4. Make a PushButton With Start caption on it

Function ElapsedTime() As String
Dim Minutes , Seconds , Hours As String
EndSeconds = New Date
EndMinutes = New Date
EndHours = New Date

Seconds = Format( Val(Str( EndSeconds.Second - StartSeconds.Second )) , "00" )
Minutes = Format( Val(Str( EndMinutes.Minute - StartSeconds.Minute )) , "00" )
Hours = Format( Val(Str( EndHours.Hour - StartMinutes.Hour )) , "00" )

Return " Duration: " + Hours + ":" + Minutes + ":" + Seconds
End Function


PushButton Sub Action()
If Me.Caption = "Start" Then
StartSeconds = New Date
StartMinutes = New Date
StartHours = New Date
MainWindow.ElapsedTimer.Enabled = True
Me.Caption = "Stop"

ElseIf Me.Caption = "Stop" Then
MainWindow.ElapsedTimer.Enabled = False
MsgBox ElapsedTime
Me.Caption = "Start"
End
End Sub


Top
 Profile  
Reply with quote  
 Post subject: Re: Application - Elapsed Time
PostPosted: Sun Nov 27, 2011 10:00 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
Gee.. you can do all of that with TWO Date objects just as easily

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Application - Elapsed Time
PostPosted: Mon Nov 28, 2011 7:47 am 
Offline

Joined: Sat Oct 01, 2005 5:28 am
Posts: 226
Location: France
... and here the timer is useles :)

_________________
RS 2010r32- PPC MacOSX5.8


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group