[Qt] bantable fix timestamp 64bit issue
This commit is contained in:
parent
6135309816
commit
f0bcbc4c8a
1 changed files with 3 additions and 7 deletions
|
@ -118,13 +118,9 @@ QVariant BanTableModel::data(const QModelIndex &index, int role) const
|
||||||
case Address:
|
case Address:
|
||||||
return QString::fromStdString(rec->subnet.ToString());
|
return QString::fromStdString(rec->subnet.ToString());
|
||||||
case Bantime:
|
case Bantime:
|
||||||
//show time in users local timezone, not 64bit compatible!
|
QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
|
||||||
//TODO find a way to support 64bit timestamps
|
date = date.addSecs(rec->bantil);
|
||||||
boost::posix_time::ptime pt1 = boost::posix_time::from_time_t(rec->bantil);
|
return date.toString(Qt::SystemLocaleShortDate);
|
||||||
boost::posix_time::ptime pt2 = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(pt1);
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << pt2;
|
|
||||||
return QString::fromStdString(ss.str());
|
|
||||||
}
|
}
|
||||||
} else if (role == Qt::TextAlignmentRole) {
|
} else if (role == Qt::TextAlignmentRole) {
|
||||||
if (index.column() == Bantime)
|
if (index.column() == Bantime)
|
||||||
|
|
Loading…
Reference in a new issue