The math of how temperature changes frequency in a crystal is complex. It depends on many variables. Some important ones are how the crystal was cut, how it is excited, and even how long the crystal has aged. So there is no easy way to correct for it in software.

As you can see from the above plots, the crystal speeds up when the temperature increases. Achim Gratz recently used a Raspberry Pi to show that as you heat up the crystal to a temperature T 0 that the temperature affects the frequency less and less. As you continue to heat up past T 0 the temperature dependence returns.

This magic temperature T 0 is called the 'zero Temperature Coefficient' point, abbreviated zero TC. In Achim’s case zero TC is when his CPU temperature is 60C. The crystal is on the flip side of the PCB board so the actual crystal temperature and zero TC is not known.

The math and physics of crystals gets complicated. If you want to dive into the theory this is a good paper on Static Frequency versus Temperature Stability