Used world.time of day

Also fixed the switching code.