diff --git a/tests/unit-tests/util/scheduler.t.cpp b/tests/unit-tests/util/scheduler.t.cpp
index 8189f01..de54800 100644
--- a/tests/unit-tests/util/scheduler.t.cpp
+++ b/tests/unit-tests/util/scheduler.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 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).
  *
@@ -55,27 +55,27 @@
   size_t count1 = 0;
   size_t count2 = 0;
 
-  scheduler.scheduleEvent(time::milliseconds(500), [&] {
+  scheduler.scheduleEvent(500_ms, [&] {
       ++count1;
       BOOST_CHECK_EQUAL(count2, 1);
     });
 
-  EventId i = scheduler.scheduleEvent(time::seconds(1), [&] {
+  EventId i = scheduler.scheduleEvent(1_s, [&] {
       BOOST_ERROR("This event should not have been fired");
     });
   scheduler.cancelEvent(i);
 
-  scheduler.scheduleEvent(time::milliseconds(250), [&] {
+  scheduler.scheduleEvent(250_ms, [&] {
       BOOST_CHECK_EQUAL(count1, 0);
       ++count2;
     });
 
-  i = scheduler.scheduleEvent(time::milliseconds(50), [&] {
+  i = scheduler.scheduleEvent(50_ms, [&] {
       BOOST_ERROR("This event should not have been fired");
     });
   scheduler.cancelEvent(i);
 
-  advanceClocks(time::milliseconds(25), time::milliseconds(1000));
+  advanceClocks(25_ms, 1000_ms);
   BOOST_CHECK_EQUAL(count1, 1);
   BOOST_CHECK_EQUAL(count2, 1);
 }
@@ -85,13 +85,13 @@
   class MyException : public std::exception
   {
   };
-  scheduler.scheduleEvent(time::milliseconds(10), [] { BOOST_THROW_EXCEPTION(MyException()); });
+  scheduler.scheduleEvent(10_ms, [] { BOOST_THROW_EXCEPTION(MyException()); });
 
   bool isCallbackInvoked = false;
-  scheduler.scheduleEvent(time::milliseconds(20), [&isCallbackInvoked] { isCallbackInvoked = true; });
+  scheduler.scheduleEvent(20_ms, [&isCallbackInvoked] { isCallbackInvoked = true; });
 
-  BOOST_CHECK_THROW(this->advanceClocks(time::milliseconds(6), 2), MyException);
-  this->advanceClocks(time::milliseconds(6), 2);
+  BOOST_CHECK_THROW(this->advanceClocks(6_ms, 2), MyException);
+  this->advanceClocks(6_ms, 2);
   BOOST_CHECK(isCallbackInvoked);
 }
 
@@ -107,11 +107,11 @@
 BOOST_AUTO_TEST_CASE(SelfCancel)
 {
   EventId selfEventId;
-  selfEventId = scheduler.scheduleEvent(time::milliseconds(100), [&] {
+  selfEventId = scheduler.scheduleEvent(100_ms, [&] {
       scheduler.cancelEvent(selfEventId);
     });
 
-  BOOST_REQUIRE_NO_THROW(advanceClocks(time::milliseconds(100), 10));
+  BOOST_REQUIRE_NO_THROW(advanceClocks(100_ms, 10));
 }
 
 class SelfRescheduleFixture : public SchedulerFixture
@@ -125,7 +125,7 @@
   void
   reschedule()
   {
-    EventId eventId = scheduler.scheduleEvent(time::milliseconds(100),
+    EventId eventId = scheduler.scheduleEvent(100_ms,
                                               bind(&SelfRescheduleFixture::reschedule, this));
     scheduler.cancelEvent(selfEventId);
     selfEventId = eventId;
@@ -142,7 +142,7 @@
     scheduler.cancelEvent(selfEventId);
 
     if (count < 5)  {
-      selfEventId = scheduler.scheduleEvent(time::milliseconds(100),
+      selfEventId = scheduler.scheduleEvent(100_ms,
                                             bind(&SelfRescheduleFixture::reschedule2, this));
       count++;
     }
@@ -153,12 +153,12 @@
   {
     scheduler.cancelEvent(selfEventId);
 
-    scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
-    scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
-    scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
-    scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
-    scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
-    scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
+    scheduler.scheduleEvent(100_ms, [&] { ++count; });
+    scheduler.scheduleEvent(100_ms, [&] { ++count; });
+    scheduler.scheduleEvent(100_ms, [&] { ++count; });
+    scheduler.scheduleEvent(100_ms, [&] { ++count; });
+    scheduler.scheduleEvent(100_ms, [&] { ++count; });
+    scheduler.scheduleEvent(100_ms, [&] { ++count; });
   }
 
 public:
@@ -168,30 +168,30 @@
 
 BOOST_FIXTURE_TEST_CASE(Reschedule, SelfRescheduleFixture)
 {
-  selfEventId = scheduler.scheduleEvent(time::seconds(0),
+  selfEventId = scheduler.scheduleEvent(0_s,
                                         bind(&SelfRescheduleFixture::reschedule, this));
 
-  BOOST_REQUIRE_NO_THROW(advanceClocks(time::milliseconds(50), time::milliseconds(1000)));
+  BOOST_REQUIRE_NO_THROW(advanceClocks(50_ms, 1000_ms));
 
   BOOST_CHECK_EQUAL(count, 5);
 }
 
 BOOST_FIXTURE_TEST_CASE(Reschedule2, SelfRescheduleFixture)
 {
-  selfEventId = scheduler.scheduleEvent(time::seconds(0),
+  selfEventId = scheduler.scheduleEvent(0_s,
                                         bind(&SelfRescheduleFixture::reschedule2, this));
 
-  BOOST_REQUIRE_NO_THROW(advanceClocks(time::milliseconds(50), time::milliseconds(1000)));
+  BOOST_REQUIRE_NO_THROW(advanceClocks(50_ms, 1000_ms));
 
   BOOST_CHECK_EQUAL(count, 5);
 }
 
 BOOST_FIXTURE_TEST_CASE(Reschedule3, SelfRescheduleFixture)
 {
-  selfEventId = scheduler.scheduleEvent(time::seconds(0),
+  selfEventId = scheduler.scheduleEvent(0_s,
                                         bind(&SelfRescheduleFixture::reschedule3, this));
 
-  BOOST_REQUIRE_NO_THROW(advanceClocks(time::milliseconds(50), time::milliseconds(1000)));
+  BOOST_REQUIRE_NO_THROW(advanceClocks(50_ms, 1000_ms));
 
   BOOST_CHECK_EQUAL(count, 6);
 }
@@ -209,7 +209,7 @@
   {
     ++count;
 
-    scheduler.scheduleEvent(time::seconds(1), [&] { event(); });
+    scheduler.scheduleEvent(1_s, [&] { event(); });
   }
 
 public:
@@ -218,15 +218,15 @@
 
 BOOST_FIXTURE_TEST_CASE(CancelAll, CancelAllFixture)
 {
-  scheduler.scheduleEvent(time::milliseconds(500), [&] { scheduler.cancelAllEvents(); });
+  scheduler.scheduleEvent(500_ms, [&] { scheduler.cancelAllEvents(); });
 
-  scheduler.scheduleEvent(time::seconds(1), [&] { event(); });
+  scheduler.scheduleEvent(1_s, [&] { event(); });
 
-  scheduler.scheduleEvent(time::seconds(3), [] {
+  scheduler.scheduleEvent(3_s, [] {
       BOOST_ERROR("This event should have been cancelled" );
     });
 
-  advanceClocks(time::milliseconds(100), 100);
+  advanceClocks(100_ms, 100);
 
   BOOST_CHECK_EQUAL(count, 0);
 }
@@ -235,7 +235,7 @@
 {
   Scheduler sched(io);
   ScopedEventId eid(sched);
-  eid = sched.scheduleEvent(time::milliseconds(10), []{});
+  eid = sched.scheduleEvent(10_ms, []{});
   sched.cancelAllEvents();
   eid.cancel(); // should not crash
 
@@ -266,7 +266,7 @@
   BOOST_CHECK_EQUAL(eid == nullptr, true);
   BOOST_CHECK_EQUAL(eid != nullptr, false);
 
-  eid = scheduler.scheduleEvent(time::milliseconds(10), []{});
+  eid = scheduler.scheduleEvent(10_ms, []{});
   BOOST_CHECK_EQUAL(eid == eid2, false);
   BOOST_CHECK_EQUAL(eid != eid2, true);
   BOOST_CHECK_EQUAL(eid == nullptr, false);
@@ -276,7 +276,7 @@
   BOOST_CHECK_EQUAL(eid == eid2, true);
   BOOST_CHECK_EQUAL(eid != eid2, false);
 
-  eid2 = scheduler.scheduleEvent(time::milliseconds(10), []{});
+  eid2 = scheduler.scheduleEvent(10_ms, []{});
   BOOST_CHECK_EQUAL(eid == eid2, false);
   BOOST_CHECK_EQUAL(eid != eid2, true);
 }
@@ -287,7 +287,7 @@
   BOOST_CHECK_EQUAL(static_cast<bool>(eid), false);
   BOOST_CHECK_EQUAL(!eid, true);
 
-  eid = scheduler.scheduleEvent(time::milliseconds(10), []{});
+  eid = scheduler.scheduleEvent(10_ms, []{});
   BOOST_CHECK_EQUAL(static_cast<bool>(eid), true);
   BOOST_CHECK_EQUAL(!eid, false);
 
@@ -302,10 +302,10 @@
 BOOST_AUTO_TEST_CASE(DuringCallback)
 {
   EventId eid;
-  EventId eid2 = scheduler.scheduleEvent(time::milliseconds(20), []{});
+  EventId eid2 = scheduler.scheduleEvent(20_ms, []{});
 
   bool isCallbackInvoked = false;
-  eid = scheduler.scheduleEvent(time::milliseconds(10), [this, &eid, &eid2, &isCallbackInvoked] {
+  eid = scheduler.scheduleEvent(10_ms, [this, &eid, &eid2, &isCallbackInvoked] {
     isCallbackInvoked = true;
 
     // eid is "expired" during callback execution
@@ -320,20 +320,20 @@
     BOOST_CHECK_EQUAL(eid == eid2, true);
     BOOST_CHECK_EQUAL(eid != eid2, false);
   });
-  this->advanceClocks(time::milliseconds(6), 2);
+  this->advanceClocks(6_ms, 2);
   BOOST_CHECK(isCallbackInvoked);
 }
 
 BOOST_AUTO_TEST_CASE(Reset)
 {
   bool isCallbackInvoked = false;
-  EventId eid = scheduler.scheduleEvent(time::milliseconds(10),
+  EventId eid = scheduler.scheduleEvent(10_ms,
                                         [&isCallbackInvoked]{ isCallbackInvoked = true; });
   eid.reset();
   BOOST_CHECK_EQUAL(!eid, true);
   BOOST_CHECK_EQUAL(eid == nullptr, true);
 
-  this->advanceClocks(time::milliseconds(6), 2);
+  this->advanceClocks(6_ms, 2);
   BOOST_CHECK(isCallbackInvoked);
 }
 
@@ -344,7 +344,7 @@
   EventId eid;
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(eid), nullString);
 
-  eid = scheduler.scheduleEvent(time::milliseconds(10), []{});
+  eid = scheduler.scheduleEvent(10_ms, []{});
   BOOST_TEST_MESSAGE("eid=" << eid);
   BOOST_CHECK_NE(boost::lexical_cast<std::string>(eid), nullString);
 }
@@ -360,9 +360,9 @@
   int hit = 0;
   {
     ScopedEventId se(scheduler);
-    se = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit; });
+    se = scheduler.scheduleEvent(10_ms, [&] { ++hit; });
   } // se goes out of scope
-  this->advanceClocks(time::milliseconds(1), 15);
+  this->advanceClocks(1_ms, 15);
   BOOST_CHECK_EQUAL(hit, 0);
 }
 
@@ -370,9 +370,9 @@
 {
   int hit1 = 0, hit2 = 0;
   ScopedEventId se1(scheduler);
-  se1 = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit1; });
-  se1 = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit2; });
-  this->advanceClocks(time::milliseconds(1), 15);
+  se1 = scheduler.scheduleEvent(10_ms, [&] { ++hit1; });
+  se1 = scheduler.scheduleEvent(10_ms, [&] { ++hit2; });
+  this->advanceClocks(1_ms, 15);
   BOOST_CHECK_EQUAL(hit1, 0);
   BOOST_CHECK_EQUAL(hit2, 1);
 }
@@ -382,10 +382,10 @@
   int hit = 0;
   {
     ScopedEventId se(scheduler);
-    se = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit; });
+    se = scheduler.scheduleEvent(10_ms, [&] { ++hit; });
     se.release();
   } // se goes out of scope
-  this->advanceClocks(time::milliseconds(1), 15);
+  this->advanceClocks(1_ms, 15);
   BOOST_CHECK_EQUAL(hit, 1);
 }
 
@@ -395,10 +395,10 @@
   unique_ptr<scheduler::ScopedEventId> se2;
   {
     ScopedEventId se(scheduler);
-    se = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit; });
+    se = scheduler.scheduleEvent(10_ms, [&] { ++hit; });
     se2.reset(new ScopedEventId(std::move(se)));
   } // se goes out of scope
-  this->advanceClocks(time::milliseconds(1), 15);
+  this->advanceClocks(1_ms, 15);
   BOOST_CHECK_EQUAL(hit, 1);
 }
 
