summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-05 17:34:43 -0700
committerGabe Black <gabeblack@google.com>2018-10-09 21:37:14 +0000
commit0a81eaabc462f09295aba4ba042e838fd6f04cb9 (patch)
treee885ee4034041292925f6dfcd18003b70160c2ea
parentcdda84fb5df278d083e02b3a7ab616b651e82f58 (diff)
downloadgem5-0a81eaabc462f09295aba4ba042e838fd6f04cb9.tar.xz
systemc: Implement sc_time::to_string.
This is just another way to call sc_time::print, but it returns a string instead of printing to a stream. Change-Id: Idc90c539127e6153af9511bfe5f258b870362330 Reviewed-on: https://gem5-review.googlesource.com/c/12596 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r--src/systemc/core/sc_time.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc
index 74345d041..69d58e512 100644
--- a/src/systemc/core/sc_time.cc
+++ b/src/systemc/core/sc_time.cc
@@ -27,6 +27,7 @@
* Authors: Gabe Black
*/
+#include <sstream>
#include <vector>
#include "base/logging.hh"
@@ -211,8 +212,9 @@ sc_time::to_seconds() const
const std::string
sc_time::to_string() const
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
- return "";
+ std::ostringstream ss;
+ print(ss);
+ return ss.str();
}
bool