Opened 13 years ago

Last modified 9 years ago

#6930 closed bug

Tracker status window problems — at Version 1

Reported by: Karvjorm Owned by: axeld
Priority: normal Milestone: R1
Component: Applications/Tracker Version: R1/Development
Keywords: Wrong year, 0 bytes Cc: Karvjorm
Blocked By: 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 (1)

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
Note: See TracTickets for help on using tickets.