Fix time_t complaint when struct timespec doesn't have a time_t seconds value

This commit is contained in:
Mark Pizzolato 2013-07-15 05:08:44 -10:00
parent 0bc76f59b9
commit 60fbaab9ce

3
scp.c
View file

@ -6910,7 +6910,8 @@ if (sim_deb_switches & (SWMASK ('T') | SWMASK ('R') | SWMASK ('A'))) {
sim_timespec_diff (&time_now, &time_now, &sim_deb_basetime); sim_timespec_diff (&time_now, &time_now, &sim_deb_basetime);
} }
if (sim_deb_switches & SWMASK ('T')) { if (sim_deb_switches & SWMASK ('T')) {
struct tm *now = gmtime(&time_now.tv_sec); time_t tnow = (time_t)time_now.tv_sec;
struct tm *now = gmtime(&tnow);
sprintf(tim_t, "%02d:%02d:%02d.%03d ", now->tm_hour, now->tm_min, now->tm_sec, (int)(time_now.tv_nsec/1000000)); sprintf(tim_t, "%02d:%02d:%02d.%03d ", now->tm_hour, now->tm_min, now->tm_sec, (int)(time_now.tv_nsec/1000000));
} }