#ifndef _TimeUtils_H_
#define _TimeUtils_H_

#include <string>
#include <functional>

class TimeUtils
{
public:
    static int64_t now();
    static	int64_t now_ms();

    static std::string now_datetime(char c1 = '-', char c2 = ':', char c3 = ' ');
    static std::string now_date(char c1 = '-');

    static int64_t datetime2ts(std::string s);
    static int64_t datetime2tms(std::string s);
    static std::string ts2datetime(int64_t ts, std::string fmt = "%Y-%m-%d %H:%M:%S");
    static std::string ts2date(int64_t ts);

    static std::string duration_str(int64_t t);

    static int64_t tick(std::function<void()> func);
};



#endif // !_TimeUtils_H_
