//文件时间比对
bool mtime_compare(QString ser_file, QString local_file)
{
QFileInfo fileInfo_local(local_file);
QFileInfo fileInfo_server(ser_file);
if(fileInfo_local.exists() && fileInfo_server.exists())
{
QDateTime local_file_time = fileInfo_local.lastModified(); //获取文件修改时间
QString local_QString = local_file_time.toString("yyyyMMddhhmmss");
QDateTime server_file_time = fileInfo_server.lastModified(); //获取文件修改时间
QString server_QString = server_file_time.toString("yyyyMMddhhmmss");
long long local_time = local_QString.toLongLong(); //数字太大不能用int
long long server_time = server_QString.toLongLong();
if(server_time > local_time)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}