Created
July 7, 2017 14:41
-
-
Save ramonsmits/c4148295f4e5886eff7489983e7ce2bf to your computer and use it in GitHub Desktop.
Get Windows uptime with c#
This file contains 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
var uptimeInSeconds = Stopwatch.GetTimestamp() / Stopwatch.Frequency; | |
var uptime = TimeSpan.FromSeconds(uptimeInSeconds); | |
Console.WriteLine(uptime); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment