Skip to content

Commit f0bcbc4

Browse files
committed
[Qt] bantable fix timestamp 64bit issue
1 parent 6135309 commit f0bcbc4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/qt/bantablemodel.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,9 @@ QVariant BanTableModel::data(const QModelIndex &index, int role) const
118118
case Address:
119119
return QString::fromStdString(rec->subnet.ToString());
120120
case Bantime:
121-
//show time in users local timezone, not 64bit compatible!
122-
//TODO find a way to support 64bit timestamps
123-
boost::posix_time::ptime pt1 = boost::posix_time::from_time_t(rec->bantil);
124-
boost::posix_time::ptime pt2 = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(pt1);
125-
std::stringstream ss;
126-
ss << pt2;
127-
return QString::fromStdString(ss.str());
121+
QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
122+
date = date.addSecs(rec->bantil);
123+
return date.toString(Qt::SystemLocaleShortDate);
128124
}
129125
} else if (role == Qt::TextAlignmentRole) {
130126
if (index.column() == Bantime)

0 commit comments

Comments
 (0)