Skip to content

Commit 15b583c

Browse files
mac build fix. Why doesn't this use the dtime() in lib/?
1 parent 10d1ef6 commit 15b583c

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

clientgui/mac/SetupSecurity.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,9 +1208,18 @@ void ShowSecurityError(const char *format, ...) {
12081208
va_end(args);
12091209
}
12101210

1211+
// return time of day (seconds since 1970) as a double
1212+
// ??? should use dtime() from lib/util.cpp
1213+
//
1214+
static double dtime2(void) {
1215+
struct timeval tv;
1216+
gettimeofday(&tv, 0);
1217+
return tv.tv_sec + (tv.tv_usec/1.e6);
1218+
}
1219+
12111220
// Uses usleep to sleep for full duration even if a signal is received
12121221
static void SleepSeconds(double seconds) {
1213-
double end_time = dtime() + seconds - 0.01;
1222+
double end_time = dtime2() + seconds - 0.01;
12141223
// sleep() and usleep() can be interrupted by SIGALRM,
12151224
// so we may need multiple calls
12161225
//
@@ -1220,7 +1229,7 @@ static void SleepSeconds(double seconds) {
12201229
} else {
12211230
usleep((int)fmod(seconds*1000000, 1000000));
12221231
}
1223-
seconds = end_time - dtime();
1232+
seconds = end_time - dtime2();
12241233
if (seconds <= 0) break;
12251234
}
12261235
}

0 commit comments

Comments
 (0)