我正確地認爲這個邏輯(在評論中解釋過)是不正確的嗎?TimeSpan.Compare comparison
// While the current time is before the finish time, sleep the current thread.
// The timer will continue to run the getting of the rates
while (TimeSpan.Compare(DateTime.Now.TimeOfDay,this._finishTime.TimeOfDay) == -1)
在我看來,看MSDN文檔,以便TimeSpan.Compare,我應該尋找,當正確的參數爲1,或0來實現這一功能之後,但是這個代碼已經在那裏好幾年。
我想知道如果這項工作發現自己在午夜左右運行會發生什麼。 – AakashM
@AakashM:哈,好吧,如果完成時間是午夜,它不可能是-1,所以它總是顯示爲完成,因爲它只是一個TimeSpan。 –