Whoops..

That number is way too big to be an int. No wonder the day var was
flipping, it wasn't 86400, it was 32767!