From 82234b4454299e0472344d5cf71bd8f70586133e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 15 Oct 2021 03:42:45 +0200 Subject: Remove dependency on xrdb for Xft.dpi --- src/AsyncImageLoader.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/AsyncImageLoader.cpp') diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp index fce745a..f926a8d 100644 --- a/src/AsyncImageLoader.cpp +++ b/src/AsyncImageLoader.cpp @@ -4,6 +4,7 @@ #include "../include/ImageUtils.hpp" #include "../include/Scale.hpp" #include "../include/SfmlFixes.hpp" +#include "../include/Utils.hpp" #include "../external/hash-library/sha256.h" #include @@ -206,10 +207,6 @@ namespace QuickMedia { thumbnail_load_data.thumbnail_data->loading_state = LoadingState::FINISHED_LOADING; } - static int64_t timeval_to_milliseconds(struct timeval &time) { - return (int64_t)time.tv_sec * 1000 + (int64_t)time.tv_usec / 1000; - } - AsyncImageLoader::AsyncImageLoader() { for(int i = 0; i < NUM_IMAGE_LOAD_PARALLEL; ++i) { downloads[i].read_program.pid = -1; @@ -233,10 +230,7 @@ namespace QuickMedia { Path tmp_thumbnail_path = download.thumbnail_path; tmp_thumbnail_path.append(".tmp"); if(status == 0 && rename_atomic(tmp_thumbnail_path.data.c_str(), download.thumbnail_path.data.c_str()) == 0) { - struct timeval time; - gettimeofday(&time, nullptr); - fprintf(stderr, "Download duration for %s: %ld ms\n", download.url.c_str(), timeval_to_milliseconds(time) - download.download_start); - + fprintf(stderr, "Download duration for %s: %ld ms\n", download.url.c_str(), get_boottime_milliseconds() - download.download_start); ThumbnailLoadData load_data = { std::move(download.url), std::move(download.thumbnail_path), false, download.thumbnail_data, download.resize_target_size }; process_thumbnail(load_data); } else { @@ -321,9 +315,7 @@ namespace QuickMedia { return; } - struct timeval time; - gettimeofday(&time, nullptr); - downloads[free_index].download_start = timeval_to_milliseconds(time); + downloads[free_index].download_start = get_boottime_milliseconds(); downloads[free_index].thumbnail_path = std::move(thumbnail_path); downloads[free_index].thumbnail_data = thumbnail_data; downloads[free_index].resize_target_size = resize_target_size; -- cgit v1.2.3