From 0a81eaabc462f09295aba4ba042e838fd6f04cb9 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 5 Sep 2018 17:34:43 -0700 Subject: 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 Maintainer: Gabe Black --- src/systemc/core/sc_time.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/systemc/core') 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 #include #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 -- cgit v1.2.3