Fix for c99 issue with time_h and resolve some warnings