To obtain a geocentric directional reference from a celestial compass requires compensation for the sun’s movement during the day, which also depends on the time of year and the observer’s latitude. We examine how insects could solve this problem, assuming they have clock neurons that represent time as a sinusoidal oscillation, and taking into account the known neuroanatomy of their celestial compass pathway. We show how this circuit could exploit trigonometric identities to perform the required spatiotemporal calculations. Our basic model assumes a constant change in sun azimuth (the 'hour angle'), which is recentred on solar noon for changing day lengths. In a more complete model, the time of year is represented by an oscillation with an annual period, and the latitude is estimated from the inclination of the geomagnetic field. We evaluate these models in simulated migration and foraging behaviours and discuss their potential for practical applications in robotics.