diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2014-08-27 11:14:07 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2014-08-27 11:19:05 +0200 |
commit | b7ceae72734f2886577c3b7a27b8f134f8051e70 (patch) | |
tree | bcaef14b1657dc4f2aa0c718235bef7c08f1d985 /src/clock.cpp | |
parent | 7fdace835b34f7655641f742eaf5fa428ca5248b (diff) |
replace timeval and time_t with boost::posix_time::ptime
Diffstat (limited to 'src/clock.cpp')
-rw-r--r-- | src/clock.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/clock.cpp b/src/clock.cpp index 8c6131e8..78867e6c 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -25,7 +25,6 @@ #ifdef ENABLE_CLOCK #include <cstring> -#include <sys/time.h> #include "global.h" #include "playlist.h" @@ -115,20 +114,20 @@ void Clock::update() myPlaylist->switchTo(); } - std::tm *time = std::localtime(&Global::Timer.tv_sec); + auto time = boost::posix_time::to_tm(Global::Timer); mask = 0; - Set(time->tm_sec % 10, 0); - Set(time->tm_sec / 10, 4); - Set(time->tm_min % 10, 10); - Set(time->tm_min / 10, 14); - Set(time->tm_hour % 10, 20); - Set(time->tm_hour / 10, 24); + Set(time.tm_sec % 10, 0); + Set(time.tm_sec / 10, 4); + Set(time.tm_min % 10, 10); + Set(time.tm_min / 10, 14); + Set(time.tm_hour % 10, 20); + Set(time.tm_hour / 10, 24); Set(10, 7); Set(10, 17); char buf[64]; - std::strftime(buf, 64, "%x", time); + std::strftime(buf, 64, "%x", &time); attron(COLOR_PAIR(int(Config.main_color))); mvprintw(w.getStarty()+w.getHeight(), w.getStartX()+(w.getWidth()-strlen(buf))/2, "%s", buf); attroff(COLOR_PAIR(int(Config.main_color))); |