Skip to content
Snippets Groups Projects
Commit 04de5d83 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Add SystemChecks.Uptime

Refers to #20
parent e8d7c45c
No related branches found
No related tags found
No related merge requests found
......@@ -150,5 +150,15 @@ namespace ATxCommon
Log.Debug("Currently running processes: {0}", procs.Substring(2));
}
}
/// <summary>
/// Get the current system uptime in seconds. Note that this will miss all times where the
/// system had been suspended / hibernated, as it is based on the OS's ticks counter.
/// </summary>
/// <returns>The time since the last system boot in seconds.</returns>
public static long Uptime() {
var ticks = Stopwatch.GetTimestamp();
return ticks / Stopwatch.Frequency;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment