From 9bca9a0b42f888cb88cedc848d471dd32a6f62d0 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 18 Aug 2020 12:50:23 +0300 Subject: features/bit-rot: simplify and cleanup internal time management Since this xlator measures time intervals in seconds, gettimeofday() may be replaced with simpler gf_time(). Adjust comments and style as well. Signed-off-by: Dmitry Antipov Change-Id: I2e5900ccb5da2478656d80e5f570487e3ba70966 Updates: #1002 --- xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c') diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c index 34e20f9df11..5cef2ffa5e5 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub-status.c @@ -40,21 +40,21 @@ br_inc_scrubbed_file(br_scrub_stats_t *scrub_stat) } void -br_update_scrub_start_time(br_scrub_stats_t *scrub_stat, struct timeval *tv) +br_update_scrub_start_time(br_scrub_stats_t *scrub_stat, time_t time) { if (!scrub_stat) return; pthread_mutex_lock(&scrub_stat->lock); { - scrub_stat->scrub_start_tv.tv_sec = tv->tv_sec; + scrub_stat->scrub_start_time = time; } pthread_mutex_unlock(&scrub_stat->lock); } void br_update_scrub_finish_time(br_scrub_stats_t *scrub_stat, char *timestr, - struct timeval *tv) + time_t time) { int lst_size = 0; @@ -67,10 +67,10 @@ br_update_scrub_finish_time(br_scrub_stats_t *scrub_stat, char *timestr, pthread_mutex_lock(&scrub_stat->lock); { - scrub_stat->scrub_end_tv.tv_sec = tv->tv_sec; + scrub_stat->scrub_end_time = time; - scrub_stat->scrub_duration = scrub_stat->scrub_end_tv.tv_sec - - scrub_stat->scrub_start_tv.tv_sec; + scrub_stat->scrub_duration = scrub_stat->scrub_end_time - + scrub_stat->scrub_start_time; snprintf(scrub_stat->last_scrub_time, lst_size, "%s", timestr); } -- cgit