Skip to content
cpp
// 时间戳转字符串
std::string timeStampToString(uint64_t timestamp)
{
    std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds> timePoint;
    timePoint = std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>(std::chrono::microseconds(timestamp));

    std::time_t time = std::chrono::system_clock::to_time_t(timePoint);
    struct tm* localTime = localtime(&time);

    char buffer[80];
    strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", localTime);

    return std::string(buffer);
}

基于 VitePress 构建