Patch level : 12.0
Files correlati : Commento : Tolto float, rimesso in int con controllo git-svn-id: svn://10.65.10.50/branches/R_10_00@23704 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									5baa352c02
								
							
						
					
					
						commit
						1b2e9ece3e
					
				@ -1083,10 +1083,9 @@ bool Win32ProgressIndicator::SetProgress(long nCurrent, long nTotal)
 | 
				
			|||||||
        const long nSec = (clock() -_start) / CLOCKS_PER_SEC;
 | 
					        const long nSec = (clock() -_start) / CLOCKS_PER_SEC;
 | 
				
			||||||
        if (nSec > 0)
 | 
					        if (nSec > 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
					// Trasformati i valori in float per evitare problemi, capitava che durante operazioni complesse nSpeed risultasse 0 per poi far crashare il programma 2 istruzioni dopo
 | 
					          const int nSpeed = nCurrent / nSec > 0 ? nCurrent / nSec : 1;	
 | 
				
			||||||
          const float nSpeed = (float)nCurrent / (float)nSec;	
 | 
					          const int nRemaining = nTotal - nCurrent;
 | 
				
			||||||
          const float nRemaining = (float)nTotal - nCurrent;
 | 
					          const int remainingTime = nRemaining / nSpeed;
 | 
				
			||||||
          const float remainingTime = nRemaining / nSpeed;	// <-- Qua
 | 
					 | 
				
			||||||
          int s = nSec;
 | 
					          int s = nSec;
 | 
				
			||||||
          const int h = s / 3600; s %= 3600;
 | 
					          const int h = s / 3600; s %= 3600;
 | 
				
			||||||
          const int m = s /   60; s %=   60;
 | 
					          const int m = s /   60; s %=   60;
 | 
				
			||||||
@ -1094,14 +1093,14 @@ bool Win32ProgressIndicator::SetProgress(long nCurrent, long nTotal)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					str = str.Format("%d%% - Trascorsi %02d:%02d:%02d", _perc, h, m, s);
 | 
										str = str.Format("%d%% - Trascorsi %02d:%02d:%02d", _perc, h, m, s);
 | 
				
			||||||
					if (nSpeed < 120)
 | 
										if (nSpeed < 120)
 | 
				
			||||||
						str << str.Format(" - Velocità %.2f/sec - %.0f sec.alla fine", nSpeed, remainingTime);
 | 
											str << str.Format(" - Velocità %d/sec - %d sec.alla fine", nSpeed, remainingTime);
 | 
				
			||||||
          else
 | 
					          else
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						const int mins = remainingTime / 60;
 | 
											const int mins = remainingTime / 60;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						str << str.Format(" - Velocità %.2f/min", nSpeed * 60);
 | 
											str << str.Format(" - Velocità %d/min", nSpeed * 60);
 | 
				
			||||||
						if (mins < 2)
 | 
											if (mins < 2)
 | 
				
			||||||
							str << str.Format(" - %.0f sec.alla fine", remainingTime);
 | 
												str << str.Format(" - %d sec.alla fine", remainingTime);
 | 
				
			||||||
						else
 | 
											else
 | 
				
			||||||
							str << str.Format(" - %d min.alla fine", mins);
 | 
												str << str.Format(" - %d min.alla fine", mins);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user