Changeset 52 for sources/src/sc_time.cc
- Timestamp:
- Jan 22, 2013, 4:23:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/sc_time.cc
r27 r52 35 35 36 36 37 #include "sc_time.h"38 37 #include <ctime> 39 38 #include <sys/time.h> 40 39 #include <string> 41 40 #include <sstream> 41 42 #include "sc_time.h" 43 42 44 #ifdef HAVE_CONFIG_H 43 45 #include "config.h" 44 46 #endif 45 47 48 46 49 namespace sc_core { 47 50 48 static const char *const unit_repr_string[6] = 49 {51 52 static const char *const unit_repr_string[6] = { 50 53 "FS", "PS", "NS", "US", "MS", "SEC" 51 54 }; … … 53 56 uint64_t nb_cycles = 0; 54 57 55 const sc_time SC_ZERO_TIME(0, SC_NS);56 sc_time SC_CURRENT_TIME(0, SC_NS);58 const sc_time SC_ZERO_TIME(0, SC_NS); 59 sc_time SC_CURRENT_TIME(0, SC_NS); 57 60 58 sc_time::sc_time (const sc_time &t)59 {60 *this = t;61 }62 61 63 sc_time::sc_time (double val, sc_time_unit tu) 64 { 65 time = (uint64_t) val; 66 unit = tu; 62 sc_time::sc_time (const sc_time & t) { 63 *this = t; 67 64 } 68 65 69 66 70 sc_time& 71 sc_time::operator = (const sc_time &t) 72 { 73 time = t.time; 74 unit = t.unit; 75 return *this; 67 sc_time::sc_time (double val, sc_time_unit tu) { 68 time = (uint64_t) val; 69 unit = tu; 76 70 } 77 71 78 72 79 const std::string 80 sc_time::to_string () const 81 { 82 std::ostringstream o; 83 o << time << ' ' << unit_repr_string[unit]; 84 return o.str(); 73 sc_time & sc_time::operator = (const sc_time & t) { 74 time = t.time; 75 unit = t.unit; 76 return *this; 85 77 } 78 79 80 const std::string sc_time::to_string() const { 81 std::ostringstream o; 82 o << time << ' ' << unit_repr_string[unit]; 83 return o.str(); 84 } 85 86 86 87 87 } // end of sc_core namespace 88 88 89 /* 90 # Local Variables: 91 # tab-width: 4; 92 # c-basic-offset: 4; 93 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 94 # indent-tabs-mode: nil; 95 # End: 96 # 97 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 98 */ 99
Note: See TracChangeset
for help on using the changeset viewer.