be consistent in time_t handling

cast time_t values with (long long) and print them with %lld. Makes time_t work
on 64-bit time_t values and is consistent throughout the code.
Fix few actual issues like assuming time_t == long.