Clean up and fix the timestamp checking

It previously would always build one more commit than necessary.
Now it will never build a commit older than the given timestamp
Use i64 in repo::ctime