[git] IDEA-125328 Don't crash if commit/author time is empty

Due to some reports, it happens sometimes in some Git repositories
for unknown reasons.

Don't throw an exception, just log it and return 0 in these cases.
[git] cleanup: move method to the only place in tests where it is used