I am currently working on android project, and I am not sure if I am just really tired and done something stupid but something doesn’t make any sense to me. I have the following code:
long pauseTime = settings.getLong("timePaused", 0);
long currentTime = common.getCurrentEpochTimeStamp();
int difference = (int) (currentTime - pauseTime);
int secondsBeforeLogOff = settings.getInt("autoLogOffTime", 10) * 60;
if (secondsBeforeLogOff > difference)
{
return true;
}
else
{
return false;
}
When I debug and step through the code above the secondsBeforeLogOff is set to 60 and the difference is 5. In the if statement I would expect it to evaluate to false, but when I step through the code it goes into both the return true and then goes into return false, but in the if statement that calls this code, it always seems to return true.
I don’t understand what is wrong with this if statement, I’ve tried swapping over the two variables in the if statement but has made no luck.
Thanks for any help you can provide.
That is correct, since 60 is greater than 5.
Also you can simply write: