2012-05-15 92 views
0

我試圖用boost :: this_thread :: sleep在多線程代碼中實現小時間延遲。 下面是代碼示例:通過auto_cpu_timer產生奇怪的b​​oost :: this_thread ::睡眠行爲

{ 
    boost::timer::auto_cpu_timer t;//just to check sleep interval 
    boost::this_thread::sleep(boost::posix_time::milliseconds(25)); 
} 

輸出困惑我點點:

0.025242s wall, 0.010000s user + 0.020000s system = 0.030000s CPU (118.9%) 

爲什麼0.025242s但不0.0025242s?

回答

2

因爲25毫秒是0.025秒; 0.0025秒將是2.5毫秒。