```\n            uint deltaTime;\n            // 1.1 check the amount of time since position is marked\n            if (pos.startLiqTimestamp > 0) {\n                 deltaTime = Math.max(deltaTime, block.timestamp - pos.startLiqTimestamp);\n            }\n            // 1.2 check the amount of time since position is past the deadline\n             if (block.timestamp > pos.positionDeadline) {\n                    deltaTime = Math.max(deltaTime, block.timestamp - pos.positionDeadline);\n            }\n            // 1.3 cap time-based discount, as configured\n              uint timeDiscountMultiplierE18 = Math.max(\n                IConfig(config).minLiquidateTimeDiscountMultiplierE18(),\n                     ONE_E18 - deltaTime * IConfig(config).liquidateTimeDiscountGrowthRateE18()\n            );\n            // 2. calculate health-based discount factor\n            uint curHealthFactorE18 = (ONE_E18 * ONE_E18) /\n             getPositionDebtRatioE18(_positionManager, _user, _posId);\n                 uint minDesiredHealthFactorE18 = IConfig(config).minDesiredHealthFactorE18s(strategy);\n            // 2.1 interpolate linear health discount factor (according to the diagram in documentation)\n            uint healthDiscountMultiplierE18 = ONE_E18;\n             if (curHealthFactorE18 < ONE_E18) {\n                 healthDiscountMultiplierE18 = curHealthFactorE18 > minDesiredHealthFactorE18\n                     ? ((curHealthFactorE18 - minDesiredHealthFactorE18) * ONE_E18) /\n            (ONE_E18 - minDesiredHealthFactorE18)\n            : 0;\n            }\n            // 3. final liquidation discount = apply the two discount methods together\n            liquidationDiscountMultiplierE18 =\n            (timeDiscountMultiplierE18 * healthDiscountMultiplierE18) /\n            ONE_E18;\n```\n