A Theory of Endogenous Time Preference, and Discounted Utility Anomalies