Page 1 of 1

tick.Time

Posted: Mon May 03, 2004 10:16 pm
by dok
tick.Time isn't showing up correctly. Here is code to get it working as described in changes.txt.

About line 434 in MQ2DataTypes.h

Changes I made are in red.

Swapped the Hours and Minute Calculations.
Removed the preceding 0 in minutes if Hours = 0 and Mins <= 9

Edit: readded the Secs=Secs% code

Code: Select all

		case Time:
			{
				int Secs=nTicks*6;
				[color=red]int Hrs=(Secs/3600);
				Secs=Secs%3600;
				int Mins=Secs/60;[/color]
				Secs=Secs%60;

				if (Hrs)
					sprintf(DataTypeTemp,"%d:%02d:%02d",Hrs,Mins,Secs);
				else
					sprintf(DataTypeTemp,"[color=red]%d[/color]:%02d",Mins,Secs);
				Dest.Ptr=&DataTypeTemp[0];
				Dest.Type=pStringType;
			}
			return true;

Posted: Mon May 03, 2004 10:39 pm
by MacroFiend
A % in a math calculation means to do modulo division which is to return the remainder of x divided by y.

Posted: Mon May 03, 2004 11:57 pm
by Zeus
Umm heard of operator -= ? :)

Posted: Tue May 04, 2004 10:32 am
by Lax
The problem was actually an extraneous Secs=Secs%60; before setting Hrs=

fixed next zip.