blob: 075b1a9cfcb1e5057cb8f341609a855ee3bfc7c7 [file] [log] [blame]
Spyridon Mastorakis86edf6f2014-11-14 19:27:18 -08001/* -*- 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
23namespace ns3 {
24namespace ndn {
25namespace time {
26
27system_clock::time_point
28CustomSystemClock::getNow() const
29{
30 boost::chrono::nanoseconds ns(Simulator::Now().GetNanoSeconds());
31 return system_clock::time_point(ns);
32}
33
34std::string
35CustomSystemClock::getSince() const
36{
37 return " since start of simulation";
38}
39
40boost::posix_time::time_duration
41CustomSystemClock::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
49steady_clock::time_point
50CustomSteadyClock::getNow() const
51{
52 boost::chrono::nanoseconds ns(Simulator::Now().GetNanoSeconds());
53 return steady_clock::time_point(ns);
54}
55
56std::string
57CustomSteadyClock::getSince() const
58{
59 return " since start of simulation";
60}
61
62boost::posix_time::time_duration
63CustomSteadyClock::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