Posts

Showing posts with the label stopwatch

Why is my Stopwatch not adding time?

Why is my Stopwatch not adding time? The class won't add on to the Stopwatch time using Speedrun.AddToTime(h, m, s) No clue as to why! class Speedrun { private static Stopwatch sr = new Stopwatch(); public static void Go() { sr.Reset(); sr.Start(); } public static string GetTime { get { return sr.Elapsed.Hours + "h " + sr.Elapsed.Minutes + "m " + sr.Elapsed.Seconds + "s"; } } public static void AddToTime(int hours, int minutes, int seconds) { TimeSpan ts = new TimeSpan(hours, minutes, seconds); sr.Elapsed.Add(ts); } public static void Stop() { sr.Stop(); } public static void Cont() { sr.Start(); } } Fairly straight forward, I'm referencing it using the class name itself, instead of a variable....