blob: 717acde2e172a0a039d3dc9fa7e8c6db168bf300 [file] [log] [blame]
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2011-2015 Regents of the University of California.
Spyridon Mastorakis86edf6f2014-11-14 19:27:18 -08004 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08005 * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
6 * contributors.
Spyridon Mastorakis86edf6f2014-11-14 19:27:18 -08007 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08008 * ndnSIM is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
Spyridon Mastorakis86edf6f2014-11-14 19:27:18 -080011 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080012 * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 **/
Spyridon Mastorakis86edf6f2014-11-14 19:27:18 -080019
20#include "ndn-time.hpp"
21
22#include "ns3/simulator.h"
23
24namespace ns3 {
25namespace ndn {
26namespace time {
27
28system_clock::time_point
29CustomSystemClock::getNow() const
30{
31 boost::chrono::nanoseconds ns(Simulator::Now().GetNanoSeconds());
32 return system_clock::time_point(ns);
33}
34
35std::string
36CustomSystemClock::getSince() const
37{
38 return " since start of simulation";
39}
40
41boost::posix_time::time_duration
42CustomSystemClock::toPosixDuration(const system_clock::duration& duration) const
43{
44 BOOST_ASSERT_MSG(false, "Must not be called");
45 return boost::posix_time::microseconds(1);
46}
47
48////////////////////////////////////
49
50steady_clock::time_point
51CustomSteadyClock::getNow() const
52{
53 boost::chrono::nanoseconds ns(Simulator::Now().GetNanoSeconds());
54 return steady_clock::time_point(ns);
55}
56
57std::string
58CustomSteadyClock::getSince() const
59{
60 return " since start of simulation";
61}
62
63boost::posix_time::time_duration
64CustomSteadyClock::toPosixDuration(const steady_clock::duration& duration) const
65{
66 BOOST_ASSERT_MSG(false, "Must not be called");
67 return boost::posix_time::microseconds(1);
68}
69
70} // namespace time
71} // namespace ndn
72} // namespace ns3