DROP FUNCTION IF EXISTS `util`.`mockTime`;
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`mockTime`()
	RETURNS datetime
	DETERMINISTIC
BEGIN
/**
 * Returns the mockTime with predefined timezone or current dateTime
 * depending of config.mockEnabled
 *
 * @return formatted datetime
 */
 DECLARE vMockEnabled BOOL;

	SELECT mockEnabled INTO vMockEnabled FROM config LIMIT 1;

	IF vMockEnabled THEN
		RETURN mockTimeBase(FALSE);
	ELSE
		RETURN util.NOW();
	END IF;
END$$
DELIMITER ;