OutdoorLightStats OutdoorLighting::getLightStats(int time) { // ASSUME: only 24 light info records, one for each whole hour //! \todo generalize this if the data file changes in the future OutdoorLightStats out; OutdoorLightStats *a, *b; int ta = time / 120; int tb = (ta + 1) % 24; float r = (time - (ta * 120)) / 120.0f; a = &lightStats[ta]; b = &lightStats[tb]; out.interpolate(a, b, r); return out; }