提示:文章
文章目录
- 前言
- 一、背景
- 二、
- 2.1
- 2.2
- 三、
- 3.1
- 总结
前言
前期疑问:
本文目标:
一、背景
最近
二、
2.1
void GetTimeWithDis::GetTimeWithDisInterval()
{for (int i = 1; i < m_timeWithDis.size(); i++) {std::string str1 = m_timeWithDis[i - 1];std::string str2 = m_timeWithDis[i];std::chrono::time_point<std::chrono::system_clock> tp1 = std::chrono::system_clock::from_time_t(timestamp2Time(std::stol(m_timeWithDis[i - 1])));std::chrono::time_point<std::chrono::system_clock> tp2 = std::chrono::system_clock::from_time_t(timestamp2Time(std::stol(m_timeWithDis[i])));// 计算两个时间点之间的差异std::chrono::milliseconds diff = std::chrono::duration_cast<std::chrono::milliseconds>(tp1 - tp2);m_timeWithDisIntervalTime.push_back(diff.count() / 1000);// 输出差异毫秒数std::cout << "The difference in milliseconds is: " << diff.count() << " ms" << std::endl;}
}void GetTimeWithDis::ShowTimeWithDisInterval()
{printf("m_timeWithDisIntervalTime\n");for (time_t interval: m_timeWithDisIntervalTime) {std::cout << "The difference in milliseconds is: " << interval << " s" << std::endl;}
}int main()
{printf("GetTimeWithDis\n");GetTimeWithDis getTimeWithDis;getTimeWithDis.m_timeWithDis.push_back("1725354889491");getTimeWithDis.m_timeWithDis.push_back("1725354191449");getTimeWithDis.m_timeWithDis.push_back("1724750800607");getTimeWithDis.GetTimeWithDisInterval();getTimeWithDis.ShowTimeWithDisInterval();return 0;
}
2.2
三、
3.1
总结
未完待续