Jump to content

Search the Community

Showing results for tags 'microseconds'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 1 result

  1. I needed this functionality for some high precision calculations I'm making. (autoit is not fast enough to support counting nanoseconds, sorry!) What's it do? It returns the number of microseconds past the current millisecond on the system clock. How accurate is it? Due to autoit limitations the counter will always be between 3-15 microseconds behind the system. ->*(This is how long autoit takes to initialize a counter) Example + UDF: _microsecinit() ;we HAVE to call this first to initialize the the counter while 1 sleep(random(25,100)) ;random sleep to show microsecond difference better ConsoleWrite(@yday&'/'&@year&' '&@HOUR&':'&@MIN&':'&@SEC&':'&@MSEC&':'&_microseconds()&@CRLF) ;call _microseconds() to get the microseconds WEnd Func _microseconds() local $ms, $ms2 if TimerDiff($microtimer) > 5000 Then $ms = @MSEC $ms2 = $ms Do $ms2 = @MSEC Until $ms2 > $ms $microtimer = TimerInit() ;attempt to re-sync microseconds EndIf $time = StringSplit(TimerDiff($microtimer), ".") $time = StringLeft($time[2], 4) return $time EndFunc func _microsecinit() local $ms, $ms2 $ms = @MSEC $ms2 = $ms Do $ms2 = @MSEC Until $ms2 > $ms global $microtimer = TimerInit() EndFunc If you have any ways of making it more precise, please submit it!
×