File 1397-Trap-for-monotonic-time-stepping-backwards.patch of Package erlang

From debc4438d4a608710b19ad867895507442f98576 Mon Sep 17 00:00:00 2001
From: Rickard Green <rickard@erlang.org>
Date: Wed, 19 Jan 2022 15:54:51 +0100
Subject: [PATCH] Trap for monotonic time stepping backwards

---
 erts/emulator/beam/erl_time_sup.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/erts/emulator/beam/erl_time_sup.c b/erts/emulator/beam/erl_time_sup.c
index 0dc85edd20..78594751eb 100644
--- a/erts/emulator/beam/erl_time_sup.c
+++ b/erts/emulator/beam/erl_time_sup.c
@@ -216,6 +216,15 @@ update_last_mtime(ErtsSchedulerData *esdp, ErtsMonotonicTime mtime)
     if (!esdp)
 	esdp = erts_get_scheduler_data();
     if (esdp) {
+#if 1
+        if (mtime < esdp->last_monotonic_time)
+            erts_exit(ERTS_ABORT_EXIT,
+                      "Monotonic time stepped backwards!\n"
+                      "Previous time: %b64d\n"
+                      "Current time:  %b64d\n",
+                      esdp->last_monotonic_time,
+                      mtime);
+#endif
 	ASSERT(mtime >= esdp->last_monotonic_time);
 	esdp->last_monotonic_time = mtime;
 	esdp->check_time_reds = 0;
-- 
2.34.1

openSUSE Build Service is sponsored by