fixed twilight time calculation

the previous calculation failed when the twilight time wrapped around UTC
midnight