Use TimeUnit constants instead of calculating milliseconds.
Fix obvious bugs in last commit.
Simpler (fewer casts) to keep these as ints.