#include "date_util.h"

#include "HCNetSDK.h"

namespace zsy
{
    std::string DateUtil::format(const std::string &pattern, const TimePoint dt)
    {
        std::time_t t = std::chrono::system_clock::to_time_t(dt);
        tm local_tm{};
        localtime_s(&local_tm, &t);
        char buffer[32];
        std::strftime(buffer, sizeof(buffer), pattern.c_str(), &local_tm);
        return std::string(buffer);
    }

    long long DateUtil::timestamp()
    {
        return std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()+ + std::chrono::hours(8)).time_since_epoch().count();
    }
} // zsy
