sc_time.hh (12925:a745745a930b) sc_time.hh (12927:6be191c20575)
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

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

101void sc_set_time_resolution(double, sc_time_unit);
102sc_time sc_get_time_resolution();
103const sc_time &sc_max_time();
104
105// Deprecated
106void sc_set_default_time_unit(double, sc_time_unit);
107sc_time sc_get_default_time_unit();
108
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

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

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