AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Time Subtraction (SOLVED)

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
JimBeam_de



Joined: 13 Jan 2009
Posts: 3

PostPosted: Tue Jan 13, 2009 11:16 am    Post subject: Time Subtraction (SOLVED) Reply with quote

Hi everybody,

i am trying to get a time subtraction running, but i somehow seem to bee a dau when i read through the help file.

Basically, i just want a timer that tells me how long my script ran. Heres what i got:

1. FormatTime, var1, T12, Time
2. Outputdebug The current time is %var1%.
3. EnvSub, timestring, %var1%, m
4. Outputdebug, Wir haben %timestring% gespielt.

My thinking process:
Line 1: set the variable var1 in the T12 time format and get the aktuell time
Line 2: tells me in debugfenster the time
Line 3: subtract timestring (set at script start) from var1
Line 4: tell me the difference in T12 time format

Unfortunately i get:
[6576] The current time is 12:10:43. <---- %timestring%
[6576] The current time is 12:10:48. <---- %var1%
[6576] Wir haben gespielt. <---- where is the time difference?


Can someone please help me and tell me where my thoughts are wrong? Probabaly just a format error, but i aint sure.

Thanks in advance for the help!

P.s. Sorry for the double post. Admin please delete the guest post Wink
[ Moderator!: Sure! Deleted it ]


Last edited by JimBeam_de on Wed Jan 14, 2009 8:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
evan
Guest





PostPosted: Tue Jan 13, 2009 11:34 am    Post subject: Reply with quote

Code:
StartTime := A_TickCount
Sleep, 1000
ElapsedTime := A_TickCount - StartTime
MsgBox,  %ElapsedTime% milliseconds have elapsed.


of course, it displays in mil-seconds, so if u want seconds, u divide by 1000, if want mins, divide 60 more
Back to top
Guest






PostPosted: Tue Jan 13, 2009 11:37 am    Post subject: Reply with quote

No useful help can be given because you have not posted your code. An outline is of no use when trying to debug code.

All I can say given your post is a quote from the help file:
Quote:
EnvSub - TimeUnits
If present, this parameter directs the command to subtract Value from Var as though both of them are date-time stamps in the YYYYMMDDHH24MISS format.
Back to top
JimBeam_de



Joined: 13 Jan 2009
Posts: 3

PostPosted: Wed Jan 14, 2009 8:56 pm    Post subject: Reply with quote

Anonymous wrote:
No useful help can be given because you have not posted your code. An outline is of no use when trying to debug code.

All I can say given your post is a quote from the help file:
Quote:
EnvSub - TimeUnits
If present, this parameter directs the command to subtract Value from Var as though both of them are date-time stamps in the YYYYMMDDHH24MISS format.


Sorry for the mis understanding. That is my code, i just put numbers in front of every line here in the post so that i could explain what i was thinking...
Back to top
View user's profile Send private message
JimBeam_de



Joined: 13 Jan 2009
Posts: 3

PostPosted: Wed Jan 14, 2009 8:57 pm    Post subject: Reply with quote

evan wrote:
Code:
StartTime := A_TickCount
Sleep, 1000
ElapsedTime := A_TickCount - StartTime
MsgBox,  %ElapsedTime% milliseconds have elapsed.


of course, it displays in mil-seconds, so if u want seconds, u divide by 1000, if want mins, divide 60 more


Thanks Tons Evan!!!! With that what you gave me i was able to tie it in just how i needed! Aweseome Forum and Awesome Support!
Back to top
View user's profile Send private message
deportivo5



Joined: 05 Sep 2008
Posts: 44

PostPosted: Fri Jan 16, 2009 3:55 am    Post subject: Reply with quote

but doesnt the values shows in 8-bits format?
is there any way to make it show just up to 2 decimal places for seconds.
cause my timer is just a few seconds only.
like 1.83 seconds?

is this possible?
_________________
I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Jan 16, 2009 4:34 am    Post subject: Reply with quote

deportivo5 wrote:
but doesnt the values shows in 8-bits format?
is there any way to make it show just up to 2 decimal places for seconds.
cause my timer is just a few seconds only.
like 1.83 seconds?

is this possible?
Code:
StartTime := A_TickCount
Sleep, 1000
ElapsedTime := (A_TickCount - StartTime) / 1000
Rounded := Round(ElapsedTime,2)
MsgBox,  %ElapsedTime% milliseconds have elapsed. Rounded is %Rounded%
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group