mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Added property to the surface to get the last update-time
This commit is contained in:
parent
a5195cc716
commit
877c654702
@ -24,6 +24,11 @@ namespace RGB.NET.Core
|
|||||||
set => SetProperty(ref _updateFrequency, value);
|
set => SetProperty(ref _updateFrequency, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the time it took the last update-loop cycle to run.
|
||||||
|
/// </summary>
|
||||||
|
public double LastUpdateTime { get; private set; }
|
||||||
|
|
||||||
private UpdateMode _updateMode = UpdateMode.Manual;
|
private UpdateMode _updateMode = UpdateMode.Manual;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the update-mode.
|
/// Gets or sets the update-mode.
|
||||||
@ -85,7 +90,8 @@ namespace RGB.NET.Core
|
|||||||
|
|
||||||
Update();
|
Update();
|
||||||
|
|
||||||
int sleep = (int)((UpdateFrequency * 1000.0) - ((DateTime.Now.Ticks - preUpdateTicks) / 10000.0));
|
LastUpdateTime = ((DateTime.Now.Ticks - preUpdateTicks) / 10000.0);
|
||||||
|
int sleep = (int)((UpdateFrequency * 1000.0) - LastUpdateTime);
|
||||||
if (sleep > 0)
|
if (sleep > 0)
|
||||||
Thread.Sleep(sleep);
|
Thread.Sleep(sleep);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user