我不明白为什么经过4个小时后此代码无法测量。
if (guildVaultRunStarter.IsRunning)
{
if (guildVaultRunTimer.ElapsedMilliseconds > 4 * 60 * 60 * 1000) // 4 hours
{
guildVaultRunStarter.Reset();
log("Its been over 4 hours - empty bags.");
return true;
}
else
{
log("guildVaultRunTimer.ElapsedMilliseconds = " +
guildVaultRunTimer.ElapsedMilliseconds.ToString() + ".");
}
}
else
{
log("Start the 4 hour guild vault countdown.");
guildVaultRunStarter.Reset();
guildVaultRunStarter.Start();
}
日志显示如下:
[8/23/2009 12:17:21 PM]:Start the 4 hour guild vault countdown.
...
[8/23/2009 12:26:53 PM]:guildVaultRunTimer.ElapsedMilliseconds = 0.
...
[8/23/2009 12:27:26 PM]:guildVaultRunTimer.ElapsedMilliseconds = 0.
为什么总是0?
最佳答案
只是guildVaultRunTimer
和guildVaultRunStarter
之间的错字吗?
即
if (guildVaultRunStarter.ElapsedMilliseconds > ...
毕竟,您似乎从来没有开始
guildVaultRunTimer
。