36b5a2c50e
gettimeofday() in order to solve problems with the construction of shared libraries [1] ; configure only once; build only those (dynamically-linked) executables that will be installed; set USE_LDCONFIG; remove an unnecessary patch; don't mix toolchains; make flags more uniform and remove obsolete flags; add test targets PR: 159189 [1] Submitted by: stephen (different version) [1]
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
--- src/taucs_timer.c.orig 2003-09-01 06:28:54.000000000 -0400
|
|
+++ src/taucs_timer.c 2012-07-10 07:24:08.000000000 -0400
|
|
@@ -245,36 +245,35 @@
|
|
#include <sys/time.h>
|
|
#include <sys/resource.h>
|
|
#include <sys/types.h>
|
|
-#include <sys/timeb.h>
|
|
|
|
double taucs_wtime()
|
|
{
|
|
- struct timeb T;
|
|
+ struct timeval T;
|
|
/*static int first_time = 1;*/
|
|
/* static time_t start_time, time_diff;
|
|
- static time_t start_mill, mill_diff;
|
|
+ static time_t start_micro, micro_diff;
|
|
*/
|
|
|
|
static time_t time_diff;
|
|
- static time_t mill_diff;
|
|
+ static time_t micro_diff;
|
|
/*int rc;*/
|
|
double dt;
|
|
|
|
- (void) ftime( &T );
|
|
+ (void) gettimeofday( &T,NULL );
|
|
/*
|
|
if (first_time) {
|
|
first_time = 0;
|
|
- start_time = T.time;
|
|
- start_mill = T.millitm;
|
|
+ start_time = T.tv_sec;
|
|
+ start_micro = T.tv_usec;
|
|
}
|
|
|
|
- time_diff = T.time - start_time;
|
|
- mill_diff = T.millitm - start_mill;
|
|
+ time_diff = T.tv_sec - start_time;
|
|
+ micro_diff = T.tv_usec - start_micro;
|
|
*/
|
|
- time_diff = T.time;
|
|
- mill_diff = T.millitm;
|
|
+ time_diff = T.tv_sec;
|
|
+ micro_diff = T.tv_usec;
|
|
|
|
- dt = ((double) time_diff) + (1e-3) * ((double) mill_diff);
|
|
+ dt = ((double) time_diff) + (1e-6) * ((double) micro_diff);
|
|
|
|
return dt;
|
|
}
|