trademaid Posted August 29, 2008 Share Posted August 29, 2008 How can i get milli or better microseconds ie @HOUR & @min & "." & @sec & "-" & @ms & Im not after a timer, but want to write to logs with microsecond time stamps Link to comment Share on other sites More sharing options...
Andreik Posted August 29, 2008 Share Posted August 29, 2008 How can i get milli or better microseconds ie @HOUR & @min & "." & @sec & "-" & @ms & Im not after a timer, but want to write to logs with microsecond time stamps Func _MSec() Local $sMilliSeconds Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8)) $stSystemTime = 0 Return $sMilliSeconds EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
monoceres Posted August 29, 2008 Share Posted August 29, 2008 How can i get milli or better microsecondsie @HOUR & @min & "." & @sec & "-" & @ms & Im not after a timer, but want to write to logs with microsecond time stampsThe latest beta has a macro called @MSECIt corresponds to milliseconds Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
trademaid Posted October 8, 2008 Author Share Posted October 8, 2008 The latest beta has a macro called @MSECIt corresponds to milliseconds Im delighted with your replies. Thank you. The two things im after is _FileWriteLog in milliseconds, though I guess a workaround for this would be very very easy@YEAR & @MON & @MDAY ..... @msecand FileGetTime in milliseconds Link to comment Share on other sites More sharing options...
trademaid Posted October 8, 2008 Author Share Posted October 8, 2008 The latest beta has a macro called @MSECIt corresponds to milliseconds Im delighted with your replies. Thank you. The two things im after is _FileWriteLog in milliseconds, though I guess a workaround for this would be very very easy@YEAR & @MON & @MDAY ..... @msecand FileGetTime in milliseconds Link to comment Share on other sites More sharing options...
trademaid Posted October 15, 2008 Author Share Posted October 15, 2008 Hi Again anyone got and FileGetTime in milliseconds? Link to comment Share on other sites More sharing options...
monoceres Posted October 15, 2008 Share Posted October 15, 2008 (edited) Feeling generous today #include <array.au3> $array=_GetFileTimeEx("Some file.ext") _ArrayDisplay($array) ; Author monoceres ; Returned array looks like this: ; [0]= year; ; [1]= month ; [2]= day of week ; [3]= day ; [4]= hour ; [5]= minute ; [6]= second ; [7]= millisecond Func _GetFileTimeEx($file) Local $return[8] $STruct=DllStructCreate("dword;dword;dword;dword;dword;dword;dword;dword;dword;") $filetime=DllStructCreate("ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort") $call=DllCall("Kernel32.dll","int","GetFileAttributesExW","wstr",$file,"int",0,"ptr",DllStructGetPtr($struct)) DllCall("Kernel32.dll","int","FileTimeToSystemTime","ptr",DllStructGetPtr($struct,2),"ptr",DllStructGetPtr($filetime)) For $i=0 To 7 $return[$i]=DllStructGetData($filetime,$i+1) Next Return $return EndFunc Enjoy Edited October 15, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
trancexx Posted October 15, 2008 Share Posted October 15, 2008 Looking at that codes I couldn't help noticing that would be really cool to have _StructDisplay() function. Something like _ArrayDisplay(). Then something like this would be possible: #Include <DllStructure.au3> $struct = _GetTime() _StructDisplay($struct) Func _GetTime() Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort') DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime)) Return $stSystemTime EndFunc ...wishes, wishes. I bet no one can do that! ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
littleclown Posted November 18, 2010 Share Posted November 18, 2010 Hello. Is there a way to get microseconds? Or 1/10 of a millisecond? Thank you in advance. Link to comment Share on other sites More sharing options...
iamtheky Posted November 18, 2010 Share Posted November 18, 2010 (edited) adding this under the arraydisplay in monoceres example? $microseconds = $array[7] * .001 msgbox (0 , '' , $microseconds) Edited November 18, 2010 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
littleclown Posted November 18, 2010 Share Posted November 18, 2010 This will not give me the actual time but just milisecond * 10. Link to comment Share on other sites More sharing options...
iamtheky Posted November 18, 2010 Share Posted November 18, 2010 (edited) nope thats my bad, dont know what i was copying. But 1 microsecond = 0.001 milliseconds. so other than the math.... Edited November 18, 2010 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 18, 2010 Moderators Share Posted November 18, 2010 littleclown, If you want to use such tiny slivers of time, I suggest you read this topic. It seems that your PC is very unlikely to be able to offer you any degree of accuracy at that level. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
littleclown Posted November 18, 2010 Share Posted November 18, 2010 This topic is mine too .I see examples in other languages:http://www.decompile.com/cpp/faq/windows_timer_api.htmhttp://www.codeproject.com/KB/dotnet/MicroTimer.aspxThats why I ask is there a solution in autoIT. I am not sure are these examples works or not. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now