Reputation: 4408
What is the WinRT replacement for System.Environment.TickCount?
Upvotes: 10
Views: 2979
Reputation: 4611
It appears System.Environment.TickCount is supported in Windows 8 Windows store apps now.
Upvotes: 1
Reputation: 941317
It should be available, because it isn't a problem. But it is not, a [TypeForwardedTo] hangup I guess because GetTickCount() isn't on the white list and .NET never adopted GetTickCount64. The standard fallback works fine, you can use pinvoke the call the native Windows function. I verified that a program that uses it passes the Windows App Certification Kit test.
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private static extern long GetTickCount64();
Note that it returns a long, not an int. You can simply cast to int to truncate if that's important in C# (but not vb.net, just lie about the return type)
Upvotes: 7