Giacomo Travaglini has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/14315

Change subject: systemc: Fix std::put_time not available in gcc < 5.0
......................................................................

systemc: Fix std::put_time not available in gcc < 5.0

As you can see from:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54354

Some iomanip helpers like std::get_time and std::put_time have been
introduced in GCC 5.0 only. put_time is calling strftime under the hood.
This patch is providing a quick fix for the broken build, replacing
std::put_time with strftime

Change-Id: Ie0cd893a0df481a26db6dbd9b613e95aef8146f0
Signed-off-by: Giacomo Travaglini <[email protected]>
---
M src/systemc/utils/vcd.cc
1 file changed, 7 insertions(+), 1 deletion(-)



diff --git a/src/systemc/utils/vcd.cc b/src/systemc/utils/vcd.cc
index ff92907..a41caf3 100644
--- a/src/systemc/utils/vcd.cc
+++ b/src/systemc/utils/vcd.cc
@@ -230,7 +230,13 @@
     time_t long_time;
     time(&long_time);
     struct tm *p_tm = localtime(&long_time);
-    stream() << std::put_time(p_tm, "     %b %d, %Y       %H:%M:%S\n");
+
+    char time_string[64];
+    auto res = strftime(time_string, sizeof(time_string),
+                        "     %b %d, %Y       %H:%M:%S\n", p_tm);
+    if (res > 0)
+        stream() << time_string;
+
     stream() << "$end" << std::endl << std::endl;

     // Version.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/14315
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ie0cd893a0df481a26db6dbd9b613e95aef8146f0
Gerrit-Change-Number: 14315
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to