Sunrise-sunset reference algorithm