util: add literal operators for duration types
Change-Id: I007fa61c80e535c6e4b12e85a32eeeee62fecc3c
Refs: #4468
diff --git a/examples/consumer-with-timer.cpp b/examples/consumer-with-timer.cpp
index a8154f5..76f9853 100644
--- a/examples/consumer-with-timer.cpp
+++ b/examples/consumer-with-timer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -48,7 +48,7 @@
run()
{
Interest interest(Name("/example/testApp/randomData"));
- interest.setInterestLifetime(time::seconds(1));
+ interest.setInterestLifetime(2_s); // 2 seconds
interest.setMustBeFresh(true);
m_face.expressInterest(interest,
@@ -59,7 +59,7 @@
std::cout << "Sending " << interest << std::endl;
// Schedule a new event
- m_scheduler.scheduleEvent(time::seconds(2), [this] { delayedInterest(); });
+ m_scheduler.scheduleEvent(3_s, [this] { delayedInterest(); });
// m_ioService.run() will block until all events finished or m_ioService.stop() is called
m_ioService.run();
@@ -95,7 +95,7 @@
std::cout << "One more Interest, delayed by the scheduler" << std::endl;
Interest interest(Name("/example/testApp/randomData"));
- interest.setInterestLifetime(time::milliseconds(1000));
+ interest.setInterestLifetime(2_s); // 2 seconds
interest.setMustBeFresh(true);
m_face.expressInterest(interest,
diff --git a/examples/consumer.cpp b/examples/consumer.cpp
index dfb6955..c302073 100644
--- a/examples/consumer.cpp
+++ b/examples/consumer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -39,7 +39,7 @@
run()
{
Interest interest(Name("/example/testApp/randomData"));
- interest.setInterestLifetime(time::milliseconds(1000));
+ interest.setInterestLifetime(2_s); // 2 seconds
interest.setMustBeFresh(true);
m_face.expressInterest(interest,
diff --git a/examples/producer.cpp b/examples/producer.cpp
index 278cc96..656ed12 100644
--- a/examples/producer.cpp
+++ b/examples/producer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -64,8 +64,8 @@
// Create Data packet
shared_ptr<Data> data = make_shared<Data>();
data->setName(dataName);
- data->setFreshnessPeriod(time::seconds(10));
- data->setContent(reinterpret_cast<const uint8_t*>(content.c_str()), content.size());
+ data->setFreshnessPeriod(10_s); // 10 seconds
+ data->setContent(reinterpret_cast<const uint8_t*>(content.data()), content.size());
// Sign Data packet with default identity
m_keyChain.sign(*data);