Oscillate or "ping pong" between two values?
===

I have a path that is evaluate at time 't' and returns an orientation and position based on the path type.

The value for time is affected by the path type:

            switch (type)
            {
                case PathType.Closed: time = ToolBox.Wrap(time, StartTime, EndTime); break;     // Wrap time around the path time to loop
                case PathType.Open: time = ToolBox.Min(time, EndTime); break;                   // Clamp the time value to the max path time range
                case PathType.Oscillating: break;
            }

The missing link is oscillating.

My question is what is a good, efficient way for oscillating between two values?  

For example (2, 7).  If time reaches 7 it reverses and decrements towards to 2 and once it reaches 2 it reverses and increases towards 7.

The algorithm should know whether to increase/decrease the value based on the original value so if the value is 9 it knows the answer is 7 - (Abs(7 - 9).  If the value is 14 the value has wrapped around so it will result in an increase of 1.  

Higher values will also increase or decrease the value depending on the number of times it wraps around the original range.

I hope that makes sense as I'm finding it difficult to explain.