From e0232d8f796963ceb37f7fb21eb840c34926373c Mon Sep 17 00:00:00 2001
From: Kristof Szabados <Kristof.Szabados@ericsson.com>
Date: Fri, 13 Nov 2020 00:31:15 +0100
Subject: [PATCH] bugfix for 568774

Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com>
---
 core/Communication.cc        | 9 +++++++--
 mctr2/mctr/MainController.cc | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/core/Communication.cc b/core/Communication.cc
index e7e22e906..890fd3472 100644
--- a/core/Communication.cc
+++ b/core/Communication.cc
@@ -860,7 +860,10 @@ void TTCN_Communication::send_create_req(const char *component_type_module,
   text_buf.push_string(component_name);
   text_buf.push_string(component_location);
   text_buf.push_int(is_alive ? 1 : 0);
-  text_buf.push_int(testcase_start_time.tv_sec);
+  int upper_int = testcase_start_time.tv_sec / 0xffffffff;
+  int lower_int = testcase_start_time.tv_sec % 0xffffffff;
+  text_buf.push_int(upper_int);
+  text_buf.push_int(lower_int);
   text_buf.push_int(testcase_start_time.tv_usec);
   send_message(text_buf);
 }
@@ -1405,7 +1408,9 @@ void TTCN_Communication::process_create_ptc()
   qualified_name current_testcase;
   incoming_buf.pull_qualified_name(current_testcase);
   timeval testcase_start_time;
-  testcase_start_time.tv_sec = incoming_buf.pull_int().get_val();
+  int upper_int = incoming_buf.pull_int().get_val();
+  int lower_int = incoming_buf.pull_int().get_val();
+  testcase_start_time.tv_sec = upper_int * 0xffffffff + lower_int;
   testcase_start_time.tv_usec = incoming_buf.pull_int().get_val();
   incoming_buf.cut_message();
 
diff --git a/mctr2/mctr/MainController.cc b/mctr2/mctr/MainController.cc
index 6e47db106..a5fd3c137 100644
--- a/mctr2/mctr/MainController.cc
+++ b/mctr2/mctr/MainController.cc
@@ -3267,7 +3267,10 @@ void MainController::send_create_ptc(host_struct *hc,
   text_buf.push_string(component_name);
   text_buf.push_int(is_alive ? 1 : 0);
   text_buf.push_qualified_name(current_testcase);
-  text_buf.push_int(testcase_start_time.tv_sec);
+  int upper_int = testcase_start_time.tv_sec / 0xffffffff;
+  int lower_int = testcase_start_time.tv_sec % 0xffffffff;
+  text_buf.push_int(upper_int);
+  text_buf.push_int(lower_int);
   text_buf.push_int(testcase_start_time.tv_usec);
   send_message(hc->hc_fd, text_buf);
 }
@@ -4171,7 +4174,9 @@ void MainController::process_create_req(component_struct *tc)
     component_location = NULL;
   }
   boolean is_alive = text_buf.pull_int().get_val();
-  testcase_start_time.tv_sec = text_buf.pull_int().get_val();
+  int upper_int = text_buf.pull_int().get_val();
+  int lower_int = text_buf.pull_int().get_val();
+  testcase_start_time.tv_sec = upper_int * 0xffffffff + lower_int;
   testcase_start_time.tv_usec = text_buf.pull_int().get_val();
 
   host_struct *host = choose_ptc_location(component_type.definition_name,
-- 
GitLab