duanmei1850 2018-11-28 07:54
浏览 149

为什么我们在Docker中睡眠时间少于指定?

I'm using Docker on Mac OS.

Engine: 18.09.0 Image: php:7-fpm

I wrote a script:

while(true) {$start = microtime(true); usleep(1000000); echo (microtime(true) - $start) . "
";}

And I see the output:

1.0008330345154
1.0003759860992
1.0002889633179
1.0007400512695
1.0017168521881
1.0014839172363
1.0003681182861
0.96751689910889
1.0006330013275
1.0007119178772
1.0007698535919
1.0011031627655
1.0003590583801
1.0012609958649
1.0004398822784
1.0004119873047

When I run the script on the host machine it works fine. Any idea why it happens? Probably something wrong with microtime accuracy?

UPD: It happens every 30s. Probably Docker does something. Time synching?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog