LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008 University of Washington | 3 * Copyright (c) 2008 University of Washington |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 int64_t | 85 int64_t |
86 Synchronizer::GetDrift (uint64_t ts) | 86 Synchronizer::GetDrift (uint64_t ts) |
87 { | 87 { |
88 NS_LOG_FUNCTION (this << ts); | 88 NS_LOG_FUNCTION (this << ts); |
89 int64_t tDrift = DoGetDrift (TimeStepToNanosecond (ts)); | 89 int64_t tDrift = DoGetDrift (TimeStepToNanosecond (ts)); |
90 | 90 |
91 if (tDrift < 0)· | 91 if (tDrift < 0)· |
92 { | 92 { |
93 return -static_cast<int64_t>(NanosecondToTimeStep (-tDrift)); | 93 return -static_cast<int64_t> (NanosecondToTimeStep (-tDrift)); |
94 } else { | 94 } else { |
95 return static_cast<int64_t>(NanosecondToTimeStep (tDrift)); | 95 return static_cast<int64_t> (NanosecondToTimeStep (tDrift)); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 bool | 99 bool |
100 Synchronizer::Synchronize (uint64_t tsCurrent, uint64_t tsDelay) | 100 Synchronizer::Synchronize (uint64_t tsCurrent, uint64_t tsDelay) |
101 { | 101 { |
102 NS_LOG_FUNCTION (this << tsCurrent << tsDelay); | 102 NS_LOG_FUNCTION (this << tsCurrent << tsDelay); |
103 return DoSynchronize (TimeStepToNanosecond (tsCurrent),· | 103 return DoSynchronize (TimeStepToNanosecond (tsCurrent),· |
104 TimeStepToNanosecond (tsDelay)); | 104 TimeStepToNanosecond (tsDelay)); |
105 } | 105 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 uint64_t | 142 uint64_t |
143 Synchronizer::NanosecondToTimeStep (uint64_t ns) | 143 Synchronizer::NanosecondToTimeStep (uint64_t ns) |
144 { | 144 { |
145 NS_LOG_FUNCTION (this << ns); | 145 NS_LOG_FUNCTION (this << ns); |
146 return NanoSeconds (ns).GetTimeStep (); | 146 return NanoSeconds (ns).GetTimeStep (); |
147 } | 147 } |
148 | 148 |
149 } // namespace ns3 | 149 } // namespace ns3 |
150 | 150 |
151 | 151 |
LEFT | RIGHT |