sc_time.hh (12983:fb1f462ae89e) sc_time.hh (13263:bcd6d8140486)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 99 unchanged lines hidden (view full) ---

108// Deprecated
109void sc_set_default_time_unit(double, sc_time_unit);
110sc_time sc_get_default_time_unit();
111
112// Nonstandard
113class sc_time_tuple
114{
115 public:
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 99 unchanged lines hidden (view full) ---

108// Deprecated
109void sc_set_default_time_unit(double, sc_time_unit);
110sc_time sc_get_default_time_unit();
111
112// Nonstandard
113class sc_time_tuple
114{
115 public:
116 sc_time_tuple() : _value(), _unit(SC_SEC), _offset(1) {}
116 sc_time_tuple() : _value(), _unit(SC_SEC), _set(false) {}
117 sc_time_tuple(const sc_time &);
118
119 bool has_value() const;
120 sc_dt::uint64 value() const;
121 // Normalized unit.
122 sc_time_unit unit() const { return _unit; }
123 // Normalized unit symbol.
124 const char *unit_symbol() const;
125
126 operator sc_time() const { return sc_time(to_double(), _unit); }
127
128 double to_double() const; // Relative to the normalized unit.
129 std::string to_string() const;
130
131 private:
132 sc_dt::uint64 _value;
133 sc_time_unit _unit;
117 sc_time_tuple(const sc_time &);
118
119 bool has_value() const;
120 sc_dt::uint64 value() const;
121 // Normalized unit.
122 sc_time_unit unit() const { return _unit; }
123 // Normalized unit symbol.
124 const char *unit_symbol() const;
125
126 operator sc_time() const { return sc_time(to_double(), _unit); }
127
128 double to_double() const; // Relative to the normalized unit.
129 std::string to_string() const;
130
131 private:
132 sc_dt::uint64 _value;
133 sc_time_unit _unit;
134 unsigned _offset;
134 bool _set;
135};
136
137} // namespace sc_core
138
139#endif //__SYSTEMC_EXT_CORE_SC_TIME_HH__
135};
136
137} // namespace sc_core
138
139#endif //__SYSTEMC_EXT_CORE_SC_TIME_HH__