1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 12:17:44 +00:00

Userland: Stop passing ignored timezones to gettimeofday

This commit is contained in:
Nico Weber 2020-08-27 17:00:00 -04:00 committed by Andreas Kling
parent ab87d42200
commit 88319b188e
3 changed files with 8 additions and 11 deletions

View file

@ -58,7 +58,6 @@ static bool in_ci = false;
static struct timeval start_time { static struct timeval start_time {
0, 0 0, 0
}; };
static struct timezone tz;
static bool g_some_test_failed = false; static bool g_some_test_failed = false;
static bool encrypting = true; static bool encrypting = true;
@ -476,18 +475,18 @@ auto main(int argc, char** argv) -> int
return 1; return 1;
} }
#define I_TEST(thing) \ #define I_TEST(thing) \
{ \ { \
printf("Testing " #thing "... "); \ printf("Testing " #thing "... "); \
fflush(stdout); \ fflush(stdout); \
gettimeofday(&start_time, &tz); \ gettimeofday(&start_time, nullptr); \
} }
#define PASS \ #define PASS \
{ \ { \
struct timeval end_time { \ struct timeval end_time { \
0, 0 \ 0, 0 \
}; \ }; \
gettimeofday(&end_time, &tz); \ gettimeofday(&end_time, nullptr); \
time_t interval_s = end_time.tv_sec - start_time.tv_sec; \ time_t interval_s = end_time.tv_sec - start_time.tv_sec; \
suseconds_t interval_us = end_time.tv_usec; \ suseconds_t interval_us = end_time.tv_usec; \
if (interval_us < start_time.tv_usec) { \ if (interval_us < start_time.tv_usec) { \

View file

@ -163,8 +163,7 @@ static void handle_sigabrt(int)
static double get_time_in_ms() static double get_time_in_ms()
{ {
struct timeval tv1; struct timeval tv1;
struct timezone tz1; auto return_code = gettimeofday(&tv1, nullptr);
auto return_code = gettimeofday(&tv1, &tz1);
ASSERT(return_code >= 0); ASSERT(return_code >= 0);
return static_cast<double>(tv1.tv_sec) * 1000.0 + static_cast<double>(tv1.tv_usec) / 1000.0; return static_cast<double>(tv1.tv_sec) * 1000.0 + static_cast<double>(tv1.tv_usec) / 1000.0;
} }

View file

@ -183,8 +183,7 @@ static void handle_sigabrt(int)
static double get_time_in_ms() static double get_time_in_ms()
{ {
struct timeval tv1; struct timeval tv1;
struct timezone tz1; auto return_code = gettimeofday(&tv1, nullptr);
auto return_code = gettimeofday(&tv1, &tz1);
ASSERT(return_code >= 0); ASSERT(return_code >= 0);
return static_cast<double>(tv1.tv_sec) * 1000.0 + static_cast<double>(tv1.tv_usec) / 1000.0; return static_cast<double>(tv1.tv_sec) * 1000.0 + static_cast<double>(tv1.tv_usec) / 1000.0;
} }