10 const int kBarWidth = 60;
19 : fDone(
false), fIFrac(-1), fStart(time(0)), fPrevCall(time(0)), fLive(
false)
51 fstat(fileno(stdout), &buf);
52 const bool isFile = (buf.st_mode & S_IFREG) || (buf.st_mode & S_IFIFO);
55 const int ifrac = (kBarWidth-1)*frac;
57 const time_t t_now = time(0);
65 std::string str(kBarWidth,
' ');
66 for(
int i = 0; i < ifrac; ++i) str[i] =
'=';
69 str[kBarWidth-1] =
']';
72 const int elapse = t_now -
fStart;
109 ret += TString::Format(
"%dh", (
int(sec+.5)/(60*60))).Data();
112 ret += TString::Format(
"%dm", (
int(sec+.5)/60)%60).Data();
115 ret += TString::Format(
"%ds", (
int(sec+.5)%60)).Data();
process_name opflashCryoW ana
bool fDone
Has Done been called?
static bool fAnyLive
Are any bars live?
Progress(const std::string &title)
Create and draw the progress bar.
int fIFrac
What character are we on? Prevents unnecessary redraws.
void SetProgress(double frac)
Update the progress fraction between zero and one.
bool fLive
Is this bar live (drawable?)
std::string FormatTime(double sec) const
void Done()
Call this when action is completed.
BEGIN_PROLOG could also be cout