QT生成时间截

来源:互联网 发布:网络主播工作室计划书 编辑:程序博客网 时间:2024/06/14 17:54

###Qt生成时间截 (网络访问经常需要)

生成时间截 毫秒/秒 相对于1970-01-01T00:00:00.000

QDateTime time = QDateTime::currentDateTime();    qint64 timestamp_msec = time.toMSecsSinceEpoch();//毫秒数    uint timestamp_sec = time.toTime_t();//秒数    qDebug()<<"\n timestamp_sec seconds that have passed since 1970-01-01T00:00:00.000 \n"<<timestamp_sec;    qDebug()<<"\n timestamp milliseconds that have passed since 1970-01-01T00:00:00.000 \n"<<timestamp_msec;
原创粉丝点击