File 0723-megaco-test-Timer-test-suite-improvements.patch of Package erlang

From d96df449f8232c33dff837b13a5f706390301b71 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Wed, 5 Jun 2019 14:13:43 +0200
Subject: [PATCH 3/5] [megaco|test] Timer test suite improvements

We did not check the actual result of the timer cancel
operation before continuing, which seems to cause
problems on some platforms (where the timer may actually
expire even though we have 100 ms to cancel).
So now we check the cancel result, and if we did not
succeed, we instead skip the test case.
---
 lib/megaco/test/megaco_timer_test.erl | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/lib/megaco/test/megaco_timer_test.erl b/lib/megaco/test/megaco_timer_test.erl
index 34479f7838..b60e8581cd 100644
--- a/lib/megaco/test/megaco_timer_test.erl
+++ b/lib/megaco/test/megaco_timer_test.erl
@@ -359,7 +359,12 @@ integer_timer_start_and_stop(Config) when is_list(Config) ->
 	{timeout, Timeout} ->
 	    error(bad_timeout)
     after Timeout - 100 ->
-	    tmr_stop(Ref)
+	    case tmr_stop(Ref) of
+                ok ->
+                    ok;
+                CancelRes ->
+                    ?SKIP({cancel_failed, CancelRes})
+            end
     end,
 
     %% Make sure it does not reach us after we attempted to stop it.
@@ -446,13 +451,5 @@ print(Prefix, F, A) ->
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 formated_timestamp() ->
-    format_timestamp(now()).
-
-format_timestamp({_N1, _N2, N3} = Now) ->
-    {Date, Time}   = calendar:now_to_datetime(Now),
-    {YYYY,MM,DD}   = Date,
-    {Hour,Min,Sec} = Time,
-    FormatDate = 
-        io_lib:format("~.4w:~.2.0w:~.2.0w ~.2.0w:~.2.0w:~.2.0w 4~w",
-                      [YYYY,MM,DD,Hour,Min,Sec,round(N3/1000)]),  
-    lists:flatten(FormatDate).
+    megaco:format_timestamp(os:timestamp()).
+
-- 
2.16.4

openSUSE Build Service is sponsored by