time-cube: factor out utility functions