Well I don't know what the all of science says there, but as far
   as I know, dreams happen in approximately 400ms AFTER you wake
   up. They're constructed quickly backwards and played forwards
   into a story that ties together stuff from the last waking
   period. == I'm a lucid dreamer. The thing is, once the lucid
   dreamer is aware they're lucid, they're already awake. They're
   still dreaming yes, but at that point, the dream's happening
   real-time and is in a different state. I got some CogSci
   diagrams somewhere about this. == I analyze my dreams regularly.
   Once you do it, it's not hard but you don't have much time. You
   have to quickly tie in the elements of the dream to things that
   happened in the last waking period. Critically, the LAST thing
   that happens in the dream is the FIRST thing that woke you up.
   It flips around (much like vision flips around in your head),
   and time runs backwards to form a dream-style plausible
   explanation of WHY you just woke up. This morning, my dream
   ended with me having an gut-level emotional reaction of shock
   and surprise in this dream that _seemed to_ last for hours and
   hours on end. The twist ending that ended me with that 'OMG I
   NEVER REALIZED" feeling was me having a tummy ache because I'd
   eaten some peanuts before I went to bed, and I was lying on my
   side, a side that gets bellyaches if I sleep on it. == The
   tricky thing is this: In that 400ms timeframe, the memory of
   HAVING the dream "back fills" your sense of time, so you are
   CERTAIN you had that thought just before you woke up from the
   dream, but really you had it the moment AFTER you woke up from
   the dream. = I like compressing lots of information in very
   small spaces. I challenge myself to compress knowledge in 6
   second segments. I'm on Vine a lot. Too much. Made 14000+ so far
   in the past 2.5 yrs but it's a good thought collector. One day,
   I woke up from a long and involved dream that ended in a loud
   crashing sound. Lightning had struck nearby the house. I could
   still hear the rumbling of the thunder, while dream became
   audible voices and I could actually time the thing, as much as I
   could think in 1/2 a second and then try to make sense of it a
   few moments later on. I captured as much as I could about the
   event, stuck as much science behind it as I could, and made a
   little graphic, then illustrated it in real time. The whole
   thing happens so quickly.
   [1]https://www.youtube.com/watch?v=7UGPsZ9FD9E ==

References

   Visible links
   1. https://l.facebook.com/l.php?u=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7UGPsZ9FD9E&h=NAQGezgnY