src/simulator/wall-clock-synchronizer.cc
changeset 3564 92ef80f0352e
parent 3560 5aa65b1ea001
child 3638 5edc4dfe0708
equal deleted inserted replaced
3563:775d9648a294 3564:92ef80f0352e
    54 //
    54 //
    55 // In order to deal with this, we are going to do a spin-wait if the simulator
    55 // In order to deal with this, we are going to do a spin-wait if the simulator
    56 // requires a delay less than a jiffy.  This is on the order of one millisecond
    56 // requires a delay less than a jiffy.  This is on the order of one millisecond
    57 // (999848 ns) on the ns-regression machine.
    57 // (999848 ns) on the ns-regression machine.
    58 // 
    58 // 
       
    59 // If the underlying OS does not support posix clocks, we'll just assume a 
       
    60 // one millisecond quantum and deal with this as best we can
       
    61 
       
    62 #ifdef CLOCK_REALTIME
    59   struct timespec ts;
    63   struct timespec ts;
    60   clock_getres (CLOCK_REALTIME, &ts);
    64   clock_getres (CLOCK_REALTIME, &ts);
    61   m_jiffy = ts.tv_sec * NS_PER_SEC + ts.tv_nsec;
    65   m_jiffy = ts.tv_sec * NS_PER_SEC + ts.tv_nsec;
    62   NS_LOG_INFO ("Jiffy is " << m_jiffy << " ns");
    66   NS_LOG_INFO ("Jiffy is " << m_jiffy << " ns");
    63 
    67 #else
       
    68   m_jiffy = 1000000;
       
    69 #endif
    64 #if 0
    70 #if 0
    65 //
    71 //
    66 // DANGER DANGER WILL ROBINSON
    72 // DANGER DANGER WILL ROBINSON
    67 //
    73 //
    68 // Don't enable this code, su root and run a sim unless you really know what
    74 // Don't enable this code, su root and run a sim unless you really know what