Control the Speed of Time and Make Every Second Count
When you are having fun, your attention will be distracted from the passing time. Your brain will therefore count less time than there is, resulting in the feeling that time flew.
When you are bored with nothing to do, your attention will be directed to the passing time. This focus on time causes your brain to count more time than there is, resulting in the feeling that time dragged.
The most compelling reason is that as we grow older there is less novelty in our life. The increase in routine causes our brains to store less mental snapshot, and empty time durations feel shorter than filled ones.
Life threatening situations raises our alertness levels causing our brains to process more mental snapshots in a short period of time. A duration that is filled with mental snapshots will appear longer than one that is empty.