Night phase

Implement night phase.

Signed-off-by: Paul Brook <paul@nowt.org>