static long compensateForDropFrame(final long framenumber, final double framerate)
	{
		//Code by David Heidelberger, adapted from Andrew Duncan

		//Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate
		final long dropFrames = Math.round(framerate * .066666);

		final long framesPer10Minutes = Math.round(framerate * 60 * 10);
		final long framesPerMinute = (Math.round(framerate) * 60) - dropFrames;

		final long d = framenumber / framesPer10Minutes;
		final long m = framenumber % framesPer10Minutes;

		//In the original post, the next line read m>1, which only worked for 29.97. Jean-Baptiste Mardelle correctly pointed out that m should be compared to dropFrames.
		if (m > dropFrames)
			return framenumber + (dropFrames * 9 * d) + dropFrames * ((m - dropFrames) / framesPerMinute);
		else
			return framenumber + dropFrames * 9 * d;
	}
static long compensateForDropFrame ( final long framenumber , final double framerate ) { final long dropFrames = Math . round ( framerate * .066666 ) ; final long framesPer10Minutes = Math . round ( framerate * 60 * 10 ) ; final long framesPerMinute = ( Math . round ( framerate ) * 60 ) - dropFrames ; final long d = framenumber / framesPer10Minutes ; final long m = framenumber % framesPer10Minutes ; if ( m > dropFrames ) return framenumber + ( dropFrames * 9 * d ) + dropFrames * ( ( m - dropFrames ) / framesPerMinute ) ; else return framenumber + dropFrames * 9 * d ; }
@param framenumber
@param framerate
should be 29.97, 59.94, or 23.976, otherwise the calculations will be off.

@return a frame number that lets us use non-dropframe computations to extract time components