src/simulator/time.cc
changeset 163 2a7e05018eeb
parent 161 c3aee00484fc
child 170 9f68cb694f40
equal deleted inserted replaced
162:5b398ac221c7 163:2a7e05018eeb
    29 Time::Time (TimeUnit<1> time)
    29 Time::Time (TimeUnit<1> time)
    30   : TimeUnit<1> (time)
    30   : TimeUnit<1> (time)
    31 {}
    31 {}
    32 
    32 
    33 double 
    33 double 
    34 Time::ApproximateToSeconds (void) const
    34 Time::GetSeconds (void) const
    35 {
    35 {
    36   HighPrecision seconds = GetHighPrecision ();
    36   HighPrecision seconds = GetHighPrecision ();
    37   seconds.Div (HighPrecision (1000000000, 0));
    37   seconds.Div (HighPrecision (1000000000, 0));
    38   return seconds.GetDouble ();
    38   return seconds.GetDouble ();
    39 }
    39 }
    40 int32_t 
    40 int32_t 
    41 Time::ApproximateToMilliSeconds (void) const
    41 Time::GetMilliSeconds (void) const
    42 {
    42 {
    43   HighPrecision ms = GetHighPrecision ();
    43   HighPrecision ms = GetHighPrecision ();
    44   ms.Div (HighPrecision (1000000, 0));
    44   ms.Div (HighPrecision (1000000, 0));
    45   return (int32_t) ms.GetHigh ();
    45   return (int32_t) ms.GetHigh ();
    46 }
    46 }
    47 int64_t 
    47 int64_t 
    48 Time::ApproximateToMicroSeconds (void) const
    48 Time::GetMicroSeconds (void) const
    49 {
    49 {
    50   HighPrecision us = GetHighPrecision ();
    50   HighPrecision us = GetHighPrecision ();
    51   us.Div (HighPrecision (1000, 0));
    51   us.Div (HighPrecision (1000, 0));
    52   return us.GetHigh ();
    52   return us.GetHigh ();
    53 }
    53 }
    54 int64_t 
    54 int64_t 
    55 Time::ApproximateToNanoSeconds (void) const
    55 Time::GetNanoSeconds (void) const
    56 {
    56 {
    57   return GetHighPrecision ().GetHigh ();
    57   return GetHighPrecision ().GetHigh ();
    58 }
    58 }
    59 
    59 
    60 
    60