Replaced the more expensive calls to DateTime.Now with DateTime.UtcNow.

This commit is contained in:
Michael Möller
2011-07-24 22:12:01 +00:00
parent 169eaf3edf
commit acbae6c98d
2 changed files with 3 additions and 3 deletions

View File

@@ -155,7 +155,7 @@ namespace OpenHardwareMonitor.GUI {
} }
protected override void OnPaint(PaintEventArgs e) { protected override void OnPaint(PaintEventArgs e) {
now = DateTime.Now - new TimeSpan(0, 0, 4); now = DateTime.UtcNow - new TimeSpan(0, 0, 4);
List<float> timeGrid = GetTimeGrid(); List<float> timeGrid = GetTimeGrid();
List<float> tempGrid = GetTemperatureGrid(); List<float> tempGrid = GetTemperatureGrid();

View File

@@ -134,7 +134,7 @@ namespace OpenHardwareMonitor.Hardware {
} }
} catch { } } catch { }
if (values.Count > 0) if (values.Count > 0)
AppendValue(float.NaN, DateTime.Now); AppendValue(float.NaN, DateTime.UtcNow);
} }
private void AppendValue(float value, DateTime time) { private void AppendValue(float value, DateTime time) {
@@ -193,7 +193,7 @@ namespace OpenHardwareMonitor.Hardware {
return currentValue; return currentValue;
} }
set { set {
DateTime now = DateTime.Now; DateTime now = DateTime.UtcNow;
while (values.Count > 0 && (now - values.First.Time).TotalDays > 1) while (values.Count > 0 && (now - values.First.Time).TotalDays > 1)
values.Remove(); values.Remove();