if(System.currentTimeMillis() > _thrust_lag + _thrust_delay);
{
this._thrust3Position = new_Position;
Log.w("Thrust Lag + Delay", Long.toString(_thrust_lag + _thrust_delay));
Log.w("Current Time", Long.toString(System.currentTimeMillis()));
_thrust_lag = System.currentTimeMillis();
}
输出为: 推力滞后+延迟:1333710037096 当前时间:1333710027174
_thrust_delay = 10000 顺便说一句。
这应该返回 false,但事实并非如此,它一直输出此语句。有人有什么想法吗?或者我在这里遗漏了一些基本的东西?
该语句中的所有变量都是长整型,而且 _thrust_lag 只在构造函数和该函数中设置一次,所以问题就在这里。
最佳答案
尾随;
结束于if
声明:删除它。
尾随;
分号导致没有执行任何语句的分支:
if (...);
等同于:
if (...)
{
}
这意味着在发布的代码中 {}
内的语句总是被执行。
关于java - 当前时间 IF 语句 GT ThrustLag,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10042610/