testtime.cpp

来自「a program that generates a pulse-width m」· C++ 代码 · 共 27 行

CPP
27
字号
// Test ftime() for time telling

#include <iostream.h>
#include <sys\timeb.h>

main(void)
    {
    double time,timenext = 0.0,time0;
    double delta_time = 0.5;
    struct timeb tt;

    ftime(&tt);
    time0 = tt.time + (double)tt.millitm / 1000.0;

    while(1)
        {
        ftime(&tt);
        time = tt.time + (double)tt.millitm / 1000.0 - time0;
        if(timenext <= time)
            {
            cout << timenext << "\n";
            timenext += delta_time;
            }
        }
    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?