Merge change 2359 into donut
* changes: Fix for the simultor build breakage.
This commit is contained in:
@ -26,6 +26,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/time.h> // for utimes
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -940,9 +941,23 @@ get_mod_time(const char* filename, struct timeval times[2])
|
|||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
times[0].tv_sec = st.st_atime;
|
times[0].tv_sec = st.st_atime;
|
||||||
times[0].tv_usec = st.st_atime_nsec / 1000;
|
|
||||||
times[1].tv_sec = st.st_mtime;
|
times[1].tv_sec = st.st_mtime;
|
||||||
|
|
||||||
|
// If st_atime is a macro then struct stat64 uses struct timespec
|
||||||
|
// to store the access and modif time values and typically
|
||||||
|
// st_*time_nsec is not defined. In glibc, this is controlled by
|
||||||
|
// __USE_MISC.
|
||||||
|
#ifdef __USE_MISC
|
||||||
|
#if !defined(st_atime) || defined(st_atime_nsec)
|
||||||
|
#error "Check if this __USE_MISC conditional is still needed."
|
||||||
|
#endif
|
||||||
|
times[0].tv_usec = st.st_atim.tv_nsec / 1000;
|
||||||
|
times[1].tv_usec = st.st_mtim.tv_nsec / 1000;
|
||||||
|
#else
|
||||||
|
times[0].tv_usec = st.st_atime_nsec / 1000;
|
||||||
times[1].tv_usec = st.st_mtime_nsec / 1000;
|
times[1].tv_usec = st.st_mtime_nsec / 1000;
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user