about summary refs log tree commit diff
path: root/src/afl-common.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-07-03 10:53:02 +0300
committerGitHub <noreply@github.com>2023-07-03 10:53:02 +0300
commit497ff5ff7962ee492fef315227366d658c637ab2 (patch)
tree4fcbea3bba9ef71ddffb185846ae69c2edf2e84f /src/afl-common.c
parent3426189c0668d2e55b18398c27e2e6400ad0b0b2 (diff)
parentdcbfc88e7d1feae344a5288decc262fa7e8bce83 (diff)
downloadafl++-497ff5ff7962ee492fef315227366d658c637ab2.tar.gz
Merge pull request #1795 from AFLplusplus/dev
push to stable
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) {