aboutsummaryrefslogtreecommitdiff
path: root/src/afl-common.c
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-07-02 14:50:18 +0200
committervanhauser-thc <vh@thc.org>2023-07-02 14:50:18 +0200
commitd5184263350335b24daab635f0bcee455302f990 (patch)
tree5c4e3f245831b7a53906d159aaba9e7854c97ee3 /src/afl-common.c
parent03bae6c4fe544f87f07cdb554daa6519d37cdfc8 (diff)
downloadafl++-d5184263350335b24daab635f0bcee455302f990.tar.gz
no_ui: display time
Diffstat (limited to 'src/afl-common.c')
-rw-r--r--src/afl-common.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/afl-common.c b/src/afl-common.c
index 84ddefd8..3e1ec09d 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -1298,6 +1298,35 @@ u8 *u_stringify_time_diff(u8 *buf, u64 cur_ms, u64 event_ms) {
}
+/* Unsafe describe time delta as simple string.
+ Returns a pointer to buf for convenience. */
+
+u8 *u_simplestring_time_diff(u8 *buf, u64 cur_ms, u64 event_ms) {
+
+ if (!event_ms) {
+
+ sprintf(buf, "00:00:00");
+
+ } else {
+
+ u64 delta;
+ s32 t_d, t_h, t_m, t_s;
+
+ delta = cur_ms - event_ms;
+
+ t_d = delta / 1000 / 60 / 60 / 24;
+ t_h = (delta / 1000 / 60 / 60) % 24;
+ t_m = (delta / 1000 / 60) % 60;
+ t_s = (delta / 1000) % 60;
+
+ sprintf(buf, "%d:%02d:%02d:%02d", t_d, t_h, t_m, t_s);
+
+ }
+
+ return buf;
+
+}
+
/* Reads the map size from ENV */
u32 get_map_size(void) {