aboutsummaryrefslogtreecommitdiff
path: root/src/AsyncImageLoader.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-15 03:42:45 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-15 03:42:45 +0200
commit82234b4454299e0472344d5cf71bd8f70586133e (patch)
tree9bffba836fa86fb5c293d46fc5d94fb08196cff4 /src/AsyncImageLoader.cpp
parente1c8cd4430015a307dbcb32894a030d5a13aee67 (diff)
Remove dependency on xrdb for Xft.dpi
Diffstat (limited to 'src/AsyncImageLoader.cpp')
-rw-r--r--src/AsyncImageLoader.cpp14
1 files changed, 3 insertions, 11 deletions
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 <unistd.h>
@@ -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;