Skip to content
/ timer Public

模仿java的timer类写的 一个cpp版的定时器工具

License

Notifications You must be signed in to change notification settings

bizehao/timer

Repository files navigation

timer

一个c++的timer工具,仿照java的timer写的 用的cpp 11

#include <iostream>
#include <iomanip>
#include "new_timer.h"
//#include "timer.h"
int main() {
    Timer timer;
    //立即执行然后每隔多少秒执行
    timer.schedule(new TimerTask([] {
        std::cout << "执行成功了1" << std::endl;
    }), 0,10000);
    //延迟多少毫秒执行并且后面每隔多少秒执行
    timer.schedule(new TimerTask([] {
        std::cout << "执行成功了2" << std::endl;
    }), 3000,5000);
    //延迟多少毫秒执行
    timer.schedule(new TimerTask([] {
        std::cout << "执行成功了3" << std::endl;
    }), 2000);
    //指定时间
    timer.schedule(new TimerTask([] {
        std::cout << "执行成功了4" << std::endl;
    }), Timer::getTime(2019,9,20,16,19));

About

模仿java的timer类写的 一个cpp版的定时器工具

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published