5 * Copyright IBM Corp. 2004, 2006.
7 * Author(s): Michael Holzheu
15 s390TodToTimeval(uint64_t todval
, struct timeval
*xtime
)
17 /* adjust todclock to 1970 */
18 todval
-= 0x8126d60e46000000LL
- (0x3c26700LL
* 1000000 * 4096);
21 xtime
->tv_sec
= todval
/ 1000000;
22 xtime
->tv_usec
= todval
% 1000000;
25 Dump::Dump(const char *filename
, const char *mode
)
27 fh
= fopen(filename
, mode
);
29 throw(DumpErrnoException("Open dump file failed!"));
41 ProgressBar::initProgress(void)
43 progressPercentage
= -1;
47 ProgressBar::displayProgress(uint64_t value
, uint64_t maxValue
)
49 char progress_bar
[51];
52 if (progressPercentage
== (int) (value
* 100 / maxValue
))
53 fprintf(stderr
, "%6lld of %6lld |\r",
54 (long long) value
, (long long) maxValue
);
55 else { /* percent value has changed */
56 progressPercentage
= (value
* 100 / maxValue
);
57 for (j
= 0; j
< progressPercentage
/ 2; j
++)
58 progress_bar
[j
] = '#';
59 for (j
= progressPercentage
/ 2; j
< 50; j
++)
60 progress_bar
[j
] = '-';
62 fprintf(stderr
, "%6lld of %6lld |%s| %3d%% \r",
63 (long long) value
, (long long) maxValue
,
64 progress_bar
, progressPercentage
);