Spyridon Mastorakis | 86edf6f | 2014-11-14 19:27:18 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2012-2014 University of California, Los Angeles |
| 4 | * |
| 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 |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | */ |
| 18 | |
| 19 | #include "ndn-time.hpp" |
| 20 | |
| 21 | #include "ns3/simulator.h" |
| 22 | |
| 23 | namespace ns3 { |
| 24 | namespace ndn { |
| 25 | namespace time { |
| 26 | |
| 27 | system_clock::time_point |
| 28 | CustomSystemClock::getNow() const |
| 29 | { |
| 30 | boost::chrono::nanoseconds ns(Simulator::Now().GetNanoSeconds()); |
| 31 | return system_clock::time_point(ns); |
| 32 | } |
| 33 | |
| 34 | std::string |
| 35 | CustomSystemClock::getSince() const |
| 36 | { |
| 37 | return " since start of simulation"; |
| 38 | } |
| 39 | |
| 40 | boost::posix_time::time_duration |
| 41 | CustomSystemClock::toPosixDuration(const system_clock::duration& duration) const |
| 42 | { |
| 43 | BOOST_ASSERT_MSG(false, "Must not be called"); |
| 44 | return boost::posix_time::microseconds(1); |
| 45 | } |
| 46 | |
| 47 | //////////////////////////////////// |
| 48 | |
| 49 | steady_clock::time_point |
| 50 | CustomSteadyClock::getNow() const |
| 51 | { |
| 52 | boost::chrono::nanoseconds ns(Simulator::Now().GetNanoSeconds()); |
| 53 | return steady_clock::time_point(ns); |
| 54 | } |
| 55 | |
| 56 | std::string |
| 57 | CustomSteadyClock::getSince() const |
| 58 | { |
| 59 | return " since start of simulation"; |
| 60 | } |
| 61 | |
| 62 | boost::posix_time::time_duration |
| 63 | CustomSteadyClock::toPosixDuration(const steady_clock::duration& duration) const |
| 64 | { |
| 65 | BOOST_ASSERT_MSG(false, "Must not be called"); |
| 66 | return boost::posix_time::microseconds(1); |
| 67 | } |
| 68 | |
| 69 | } // namespace time |
| 70 | } // namespace ndn |
| 71 | } // namespace ns3 |