Solution to clock exercise