improved daytimes conversion performance in period.c
Especially when using repeated conversion with period_asfreq_arr of tslib the code introduced with #3060 was about two to three times slower than before.

This PR improves the performance issues by moving global calculations out of the loop.
