   Time Syncronization Issues
  So, I'm writing a generic class that takes a structure with information ona source value and how it should change over time and modifies that value viaa pointer. I seem to have implemented it wrong, because whenever I pass it astructure and run it, the value comes out vastly unexpected. My game enginerelies heavily on vectors (where lists may serve it better, but it's a workin progress) and I think that it might be part of the problem, but I'm not changing the vectors size during this execution. I'll throw up the code...Honestly, this was supposed to solve problems, but it just broke my engine.class gEvent{protected:union{double *d;long *l;} m_ptr;union{double d;long l;} m_result;union{double d;long l;} m_init;char m_format;//long l//double dfloat m_duration;float m_start;long m_handle;public:gEvent();gEvent(const gEvent &rhs);gEvent(double *d, float time, double val);gEvent(long *l, float time, long val);void operator=(const gEvent& rhs);void SetDuration(float time);void SetValue(double d);void SetValue(long l);void Start(float now);bool Step(float now); //Steps the value of the pointervoid SetPointer(long *l);void SetPointer(double *d);};The functions are named for their functions, aptly enough. Here's the code that runs through a deque of these structures.bool CORE::Game::gEvent::Step(float now){if(m_ptr.l == NULL || m_ptr.d == NULL)return false; //Done, delete the instanceswitch(m_format){case 'l':if((m_duration<(now-m_start))){*m_ptr.l = m_result.l;return false;}(*m_ptr.l) = (m_init.l)*(m_duration/(now-m_start));return true;break;case 'd':if((m_duration<(now-m_start))){*m_ptr.d = m_result.d;return false;}(*m_ptr.d) = (m_init.d)*(m_duration/(now-m_start));return true;break;default:return false;break;}}Is there a better way to generically time data changes? I've done somegoogling, but can't seem to hit the right keywords or something.   
  Well, do you want to interpolate a value between 'init' and 'result' in time 'duration' ?If this assumption is correct, your interpolation code should look like(*m_ptr.d) = (m_init.d) + (m_result.d - m_init.d)*(m_duration/(now-m_start));--Ashaman;  I've actually fixed that, my code is a little different, but functionally equivalent. The code seems to change the values, but resets to zero every otherframe. I am unsure why, but it looks like the start value is reseting to the nowvalue every other frame or something similar.   ;  so what your writing is an interpolator. your basically interpolating between two values over a period of time. lots of implementations available, anyway, im going to guess here, but what are you using as your units of time? each frame will occur after a very very small amount of time has passed, so if your using seconds as a measure of time, then its quite possible that your interpolation will be the starting value (as the amount of interpolation is close enough to 0 to be 0). make sure you get your units right, and it should be pretty straightforward to put together an interpolator.also, do you really need to use unions? looks like your overcomplicating things dramatically. the code should be very very simple.   ;  I'm using unions because I would rather not type-cast a void pointer.I guess I could use templates and visualization to do the same.  I guess I could do that. I think my units are in either miliseconds or clock-cycles. However, the code should compensate for instantaneoustransformation (a duration of zero or less) and simply assign the pointerto the result value before being deleted. The fraction is constantlybeing set to zero. On the occasion when it actually displays anything, Ican see the sprite flick rapidly back and forth, between the zero valueand some small fraction of it's entire journey.   