summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--content/llcache.c18
2 files changed, 12 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 976815e8b..b37dcba22 100644
--- a/Makefile
+++ b/Makefile
@@ -493,7 +493,8 @@ $(eval $(call feature_switch,HARU_PDF,PDF export (haru),-DWITH_PDF_EXPORT,-lhpdf
$(eval $(call feature_switch,LIBICONV_PLUG,glibc internal iconv,-DLIBICONV_PLUG,,-ULIBICONV_PLUG,-liconv))
# Common libraries with pkgconfig
-$(eval $(call pkg_config_find_and_add,libutf8proc,UTF8PROC))
+$(eval $(call pkg_config_find_and_add,libutf8proc,utf8proc))
+$(eval $(call pkg_config_find_and_add,libnsutils,nsutils))
# Common libraries without pkg-config support
LDFLAGS += -lz
diff --git a/content/llcache.c b/content/llcache.c
index e97beb97e..3c46a6d22 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -36,8 +36,10 @@
*/
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <curl/curl.h>
+#include <nsutils/time.h>
#include "utils/config.h"
@@ -2306,11 +2308,10 @@ write_backing_store(struct llcache_object *object, size_t *written_out, unsigned
nserror ret;
uint8_t *metadata;
size_t metadatasize;
- struct timeval start_tv;
- struct timeval end_tv;
- struct timeval elapsed_tv;
+ uint64_t startms = 0;
+ uint64_t endms = 1000;
- gettimeofday(&start_tv, NULL);
+ nsu_getmonotonic_ms(&startms);
/* put object data in backing store */
ret = guit->llcache->store(object->url,
@@ -2343,15 +2344,16 @@ write_backing_store(struct llcache_object *object, size_t *written_out, unsigned
guit->llcache->invalidate(object->url);
return ret;
}
- gettimeofday(&end_tv, NULL);
-
- timersub(&end_tv, &start_tv, &elapsed_tv);
+ nsu_getmonotonic_ms(&endms);
object->store_state = LLCACHE_STATE_DISC;
*written_out = object->source_len + metadatasize;
- *elapsed = (elapsed_tv.tv_sec * 1000) + (elapsed_tv.tv_usec / 1000);
+ /* by ignoring the overflow this assumes the writeout took
+ * less than 5 weeks.
+ */
+ *elapsed = endms - startms;
return NSERROR_OK;
}