Created
September 8, 2016 21:08
-
-
Save Iristyle/a6cb43d3d6d9f3756b29ef1706120e8b to your computer and use it in GitHub Desktop.
Windows API GetTickCount64 used to retrieve system uptime on Windows with 64-bit resolution (5000+ years)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $signature = @' | |
| [DllImport(@"kernel32.dll", SetLastError=true)] | |
| public static extern UInt64 GetTickCount64 (); | |
| '@ | |
| $type = Add-Type -MemberDefinition $signature -Name SystemTime -Namespace GetTickCount64 -PassThru | |
| [System.TimeSpan]::FromMilliseconds($type::GetTickCount64()) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This API exists on Vista+ - no 32-bit vs 64-bit issues.