Fix - cmake failure on Windows - check time_t.

Check that the testprogram compiled before we test the result from running the test. This fixes error when running cmake on Windows.