Project

General

Profile

Actions

Feature #2158

closed

Specialize system and steady clocks

Added by Alex Afanasyev over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Utils
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Description

Add ability to replace ndn::time::system_clock and ndn::time::steady_clock with custom implementations.

There are two cases when such functionality is needed:

  • to run timing-related unit tests without actually relying on wall clock (which is error prone)
  • to run ndn-cxx-based applications in simulated environment (e.g., NS-3)
Actions #1

Updated by Alex Afanasyev over 9 years ago

  • Status changed from In Progress to Code review
  • Target version changed from Unsupported to v0.3
  • % Done changed from 0 to 100
Actions #2

Updated by Alex Afanasyev over 9 years ago

I was hoping it wouldn't be necessary, but apparently it is. At least on Linux platform (http://jenkins.named-data.net/job/ndn-cxx/1472/).

One more change is required to make scheduler work properly with arbitrary time advancement: deadline timer (timer traits) needs to be modified to ensure internal boost waiting doesn't optimize waiting.

In particular, monotonic_deadline_timer.hpp after line 65 should look like

static boost::posix_time::time_duration
to_posix_duration(const duration_type& duration)
{
  return boost::posix_time::microseconds(1);
}

Some more info is in http://stackoverflow.com/questions/14191855/how-do-you-mock-the-time-for-boost-timers

With this "fix", certificate cache test cases working properly on linux platform.


Wonder what would be the best way to deal with this customization? Another global variable?

Actions #3

Updated by Junxiao Shi over 9 years ago

  • Tracker changed from Task to Feature
  • Subject changed from Add ability to replace ndn::time::system_clock and ndn::time::steady_clock with custom implementations to Specialize system and steady clocks
  • Description updated (diff)
  • Status changed from Code review to Closed
  • Start date deleted (11/10/2014)
Actions

Also available in: Atom PDF