hour logic