--- trunk/src/utils/ProgressBar.cpp 2012/08/30 17:18:22 1790 +++ trunk/src/utils/ProgressBar.cpp 2013/10/31 18:18:57 1939 @@ -35,11 +35,15 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ +#ifdef IS_MPI +#include +#endif + #include #include @@ -52,12 +56,9 @@ #else #include #include +#include #endif -#ifdef IS_MPI -#include -#endif - #include "utils/ProgressBar.hpp" using namespace std; @@ -86,8 +87,6 @@ namespace OpenMD { void ProgressBar::update() { - int width; - #ifdef IS_MPI if (MPI::COMM_WORLD.Get_rank() == 0) { #endif @@ -96,13 +95,14 @@ namespace OpenMD { if (isatty(fileno(stdout)) && (getenv("SGE_TASK_ID")==NULL)) { // get the window width: + int width = 0; #ifdef _MSC_VER CONSOLE_SCREEN_BUFFER_INFO csbi; HANDLE hConsole = GetStdHandle( STD_OUTPUT_HANDLE ); int ret = GetConsoleScreenBufferInfo(hConsole, &csbi); if(ret) { width = csbi.dwSize.X - 1; - } + } #else struct winsize w; ioctl(fileno(stdout), TIOCGWINSZ, &w); @@ -130,7 +130,8 @@ namespace OpenMD { // compute the best estimate of the ending time: time_t current_ = time(NULL); - time_t end_ = start_ + (current_ - start_) * (100.0/percent); + time_t end_ = static_cast(start_ + (current_ - start_) * + (100.0/percent) ); struct tm * ender = localtime(&end_); char buffer[22]; strftime(buffer, 22, "%a %b %d @ %I:%M %p", ender);