Jump to content

How to reset timer count?


Recommended Posts

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

Link to comment
Share on other sites

  • 2 years later...

~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. 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...