Human performance in a timing task depends on the context of recently experienced time intervals. In fact, people may use prior experience to improve their timing performance. Given the relevance of time for both sensing and acting in the world, how humans learn and represent temporal information is a fundamental question in neuroscience. Here, we ask subjects to reproduce the duration of time intervals drawn from different distributions (different temporal contexts). We build a set of models of how people might behave in such a timing task, depending on how they are representing the temporal context. Comparison between models and data allows us to establish that in general subjects are integrating task-relevant temporal information with the provided error feedback to enhance their timing performance. Analysis of the subjects' responses allows us to reconstruct their internal representation of the temporal context, and we compare it with the true distribution. We find that with the help of corrective feedback humans can learn good approximations of unimodal distributions of time intervals used in the experiment, even for skewed distributions of durations; on the other hand, under similar conditions, we find that multimodal distributions of timing intervals are much harder to acquire.