Sign in to follow this  
Followers 0
NoHAX

How to reset timer count?

7 posts in this topic

I need to reset timer value, eg.

timer = _TimerInit()

If _Timer_Diff($timer) Then
; Set $timer value to 0
EndIf

I tried sth with KillTimer but it wont work

Share this post


Link to post
Share on other sites



re-init the timer with the same first line but within the if-then statement

timer = _TimerInit()

If _Timer_Diff($timer) Then
; Set $timer value to 0
timer = _TimerInit()

EndIf

there are inbuilt functions TimerInit / TimerDiff in AutoIt, you might want to use them instead of an extra include.

g'day!

hench

Share this post


Link to post
Share on other sites

~Sorry for the necro but this sems quite what i need and its like 3rd result on search page ~

 

Due recent hard-drive fault i lost a log-rotation program and i need to rewrite it now. I remember, when using timers within a program , and if that program is running more than 24h, the timers begin to be innacurate. I cannot remember wich one was , the built-in timer or the included one, so can someone tell me does _TimerInit (i am zeroing the timer from within an If-else statement) affect the accuracy of the timer, or i need to completly kill it and init it again ? i am also not sure does this problem exist, it was long ago since i noticed this, and never actually used timers after that, so my opinion is to ask the geeks :D The timer difference occur when the computer is under very heavy load (and the one i use is ), and after 24th hour timers begin to be very inaccurate (+- 30 secs and more)

code represent few keys being pressed every 30 min (exactly 30 min)  i believe there is no need of source here. 

Share this post


Link to post
Share on other sites

JustSomeone,

As far as I know both native and UDF timers just look at the difference in CPU "ticks" since they were initiated and are not really designed for delays of the size you are using. I would strongly suggest creating your own function using _DateDiff & _NowCalc - then your timings are based on the accuracy of the PC clock, and mine certainly does not vary by 30 secs a day. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

You can also use epoch functions (based on date functions), you can find some on the forum.

In my opinion it's more efficient for algorithmic calculation :)

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Thanks ~ 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0