mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-20 22:15:41 +00:00
Merge pull request #224 from PartialVolume/fix_summary_duration_during_shutdown_in_middle_of_wipe
Fix incorrect summary duration during shutdown
This commit is contained in:
@@ -627,15 +627,21 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected )
|
||||
/* Add this devices throughput to the total throughput */
|
||||
total_throughput += c[i]->throughput;
|
||||
|
||||
/* Retrieve the duration of the wipe in seconds and convert hours and minutes and seconds */
|
||||
/* WARNING More work needs doing on ..
|
||||
*
|
||||
* model
|
||||
* serial no
|
||||
* the footer
|
||||
* testing under various fault situations ... WARNING */
|
||||
/* Retrieve the duration of the wipe in seconds and convert to hours and minutes and seconds */
|
||||
|
||||
c[i]->duration = difftime( c[i]->end_time, c[i]->start_time );
|
||||
if( c[i]->start_time != 0 && c[i]->end_time != 0 )
|
||||
{
|
||||
/* For a summary when the wipe has finished */
|
||||
c[i]->duration = difftime( c[i]->end_time, c[i]->start_time );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( c[i]->start_time != 0 && c[i]->end_time == 0 )
|
||||
{
|
||||
/* For a summary in the event of a system shutdown */
|
||||
c[i]->duration = difftime( t, c[i]->start_time );
|
||||
}
|
||||
}
|
||||
|
||||
total_duration_seconds = (u64) c[i]->duration;
|
||||
|
||||
|
||||
@@ -269,8 +269,13 @@ int main( int argc, char** argv )
|
||||
/* A result buffer for the BLKGETSIZE64 ioctl. */
|
||||
u64 size64;
|
||||
|
||||
/* Initialise the spinner character index */
|
||||
c2[i]->spinner_idx = 0;
|
||||
|
||||
/* Initialise the start and end time of the wipe */
|
||||
c2[i]->start_time = 0;
|
||||
c2[i]->end_time = 0;
|
||||
|
||||
/* Initialise the wipe_status flag, -1 = wipe not yet started */
|
||||
c2[i]->wipe_status = -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user