summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/content.c11
-rw-r--r--content/content_protected.h7
2 files changed, 11 insertions, 7 deletions
diff --git a/content/content.c b/content/content.c
index 4048d8278..e112f3844 100644
--- a/content/content.c
+++ b/content/content.c
@@ -23,6 +23,7 @@
#include <inttypes.h>
#include <stdlib.h>
+#include <nsutils/time.h>
#include "utils/utils.h"
#include "utils/log.h"
@@ -96,7 +97,7 @@ nserror content__init(struct content *c, const content_handler *handler,
c->available_width = 0;
c->quirks = quirks;
c->refresh = 0;
- c->time = wallclock();
+ nsu_getmonotonic_ms(&c->time);
c->size = 0;
c->title = NULL;
c->active = 0;
@@ -215,10 +216,9 @@ static void content_update_status(struct content *c)
c->sub_status[0] != '\0' ? ", " : " ",
c->sub_status);
} else {
- unsigned int time = c->time;
snprintf(c->status_message, sizeof (c->status_message),
"%s (%.1fs)", messages_get("Done"),
- (float) time / 100);
+ (float) c->time / 1000);
}
}
@@ -311,9 +311,12 @@ void content_set_ready(struct content *c)
void content_set_done(struct content *c)
{
union content_msg_data msg_data;
+ uint64_t now_ms;
+
+ nsu_getmonotonic_ms(&now_ms);
c->status = CONTENT_STATUS_DONE;
- c->time = wallclock() - c->time;
+ c->time = now_ms - c->time;
content_update_status(c);
content_broadcast(c, CONTENT_MSG_DONE, msg_data);
}
diff --git a/content/content_protected.h b/content/content_protected.h
index 148dc131e..1e7916290 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -126,9 +126,10 @@ struct content {
struct content_rfc5988_link *links; /**< list of metadata links */
- unsigned int time; /**< Creation time,
- if LOADING or READY,
- otherwise total time. */
+ /** Creation timestamp when LOADING or READY.
+ * Total time in ms when DONE.
+ */
+ uint64_t time;
uint64_t reformat_time; /**< Earliest time to attempt a period
* reflow while fetching a page's objects.