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>
This commit is contained in:
Gabe Black
2018-09-05 17:34:43 -07:00
parent cdda84fb5d
commit 0a81eaabc4

View File

@@ -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