Change C-style-casts to static_cast in time_helper.h

At the request of @mj-xmr: https://github.com/monero-project/monero/pull/8211#discussion_r822868321
This commit is contained in:
Jeffrey 2022-03-09 11:15:25 -06:00
parent b49ed59166
commit 175b4117a9

View file

@ -58,13 +58,13 @@ namespace misc_utils
inline std::string get_time_interval_string(const time_t& time_) inline std::string get_time_interval_string(const time_t& time_)
{ {
time_t tail = time_; time_t tail = time_;
const int days = (int) (tail/(60*60*24)); const int days = static_cast<int>(tail/(60*60*24));
tail = tail%(60*60*24); tail = tail%(60*60*24);
const int hours = (int) (tail/(60*60)); const int hours = static_cast<int>(tail/(60*60));
tail = tail%(60*60); tail = tail%(60*60);
const int minutes = (int) (tail/(60)); const int minutes = static_cast<int>(tail/60);
tail = tail%(60); tail = tail%(60);
const int seconds = (int) tail; const int seconds = static_cast<int>(tail);
char tmpbuf[64] = {0}; char tmpbuf[64] = {0};
snprintf(tmpbuf, sizeof(tmpbuf) - 1, "d%d.h%d.m%d.s%d", days, hours, minutes, seconds); snprintf(tmpbuf, sizeof(tmpbuf) - 1, "d%d.h%d.m%d.s%d", days, hours, minutes, seconds);