Opened 13 years ago

Closed 9 years ago

#6930 closed bug (duplicate)

Tracker status window problems

Reported by: Karvjorm Owned by: nobody
Priority: normal Milestone: R1
Component: Applications/Tracker Version: R1/Development
Keywords: Wrong year, 0 bytes Cc: Karvjorm
Blocked By: #11176 Blocking:
Platform: All

Description (last modified by anevilyak)

I just moved a directory that included several subdirectories (and some files in the last one) to the Trash. Tracker status windows showed below progress bar the following information: "(1 bytes of 0 bytes, 0 bytes/s)".

Then just when moving was completed, I saw on the right (below the progress bar) a message text that informed when work completed. At the end of text was a non-localized date, something like: "12/12/1901". That was right, the year was 1901 !

I suppose that the origin of the last problem is in this TODO (in /src/kits/tracker/StatusWindow.cpp):

			double totalBytesPerSecond = (double)(fSizeProcessed
 					- fEstimatedFinishReferenceSize)
 				* 1000000LL / (system_time() - fEstimatedFinishReferenceTime);
 			double secondsRemaining = (fTotalSize - fSizeProcessed)
 				/ totalBytesPerSecond;
 			time_t now = (time_t)real_time_clock();
 			time_t finishTime = (time_t)(now + secondsRemaining);
 
 			tm _time;
 			tm* time = localtime_r(&finishTime, &_time);
 			int32 year = time->tm_year + 1900;
 
 			char timeText[32];
 			time_t secondsPerDay = 24 * 60 * 60;
 			// TODO: Localization of time string...
 			if (now < finishTime - secondsPerDay) {
 				// process is going to take more than a day!
 				sprintf(timeText, "%0*d:%0*d %0*d/%0*d/%ld",
 					2, time->tm_hour, 2, time->tm_min,
 					2, time->tm_mon + 1, 2, time->tm_mday, year);
 			} else {
 				sprintf(timeText, "%0*d:%0*d",
 					2, time->tm_hour, 2, time->tm_min);
 			}
 
 			BString buffer1("Finish: ");
 			buffer1 << timeText;
 			finishTime -= now;
 			time = gmtime(&finishTime);
 
 			BString buffer2;
 			if (finishTime > secondsPerDay)
 				buffer2 << "Over " << finishTime / secondsPerDay << "days";
 			else if (finishTime > 60 * 60)
 				buffer2 << "Over " << finishTime / (60 * 60) << " hours";
 			else if (finishTime > 60)
 				buffer2 << finishTime / 60 << " minutes";
 			else
 				buffer2 << finishTime << " seconds";
 
 			buffer2 << " left";
 
 			buffer = "(";
 			buffer << buffer1 << " - " << buffer2 << ")";
 			tp.x = fStatusBar->Frame().right - StringWidth(buffer.String());
 			if (tp.x > rightDivider)
 				DrawString(buffer.String(), tp);
 			else {
 				// complete string too wide, try with shorter version
 				buffer = "(";
 				buffer << buffer1 << ")";
 				tp.x = fStatusBar->Frame().right - StringWidth(buffer.String());
 				if (tp.x > rightDivider)
 					DrawString(buffer.String(), tp);
 			}

Change History (4)

comment:1 by anevilyak, 13 years ago

Component: Add-Ons/TrackerApplications/Tracker
Description: modified (diff)
Owner: changed from nobody to axeld
Version: R1/alpha2R1/Development

comment:2 by pulkomandy, 13 years ago

Owner: changed from axeld to pulkomandy
Status: newassigned

comment:3 by pulkomandy, 13 years ago

Owner: changed from pulkomandy to nobody

Fixed the TODO part in hrev42977. Not sure about the other part, it doesn't seem to be related. Somehow the computations from the status window went wrong ?

comment:4 by diver, 9 years ago

Blocked By: 11176 added
Resolution: duplicate
Status: assignedclosed
Note: See TracTickets for help on using tickets.