FluffyMarshmellows - Because when we dream our eyes move rapidly (REM) we know how long dreams last.
If we slept for eight hours, a typical pattern would be to pass into Delta sleep, stay there for about seventy to ninety minutes, then return to stage two and dream for about five minutes. We then move back into Delta sleep, stay for a short period and shift back to level two, but without dreaming, then back into level three. The next return to stage two is longer, almost an hour, with a period of dreaming lasting about nineteen minutes, and also a short period of return to waking. There is only one short period of return to stage three sleep that occurs nearly four hours after falling asleep. From there on we remain in level two sleep, with three or four lengthening periods of dreaming, and returns to brief wakefulness. The average amount of body shifting is once every fifteen minutes.
But often it seems as if we have been having a dream lasting for ages, but this is because, as with films, we cut from one scene to another giving an experience of time. The longest period of dreaming is just before we wake in the morning - probably about 30 minuted.