Consider this thought experiment. Of course it is not practical to actually do this every morning, but I'm trying to explain the principle.
- Take a wall calendar with one square for each day. For today and the 179 preceding days, mark the day with a cross if you had been within Schengen and with a slash if you had been outside. If you haven't been to Schengen lately, that's easy, just 180 slashes from today backwards.
- Each morning as you wake up, you mark the new day with a cross if you are within Schengen and with a slash if you are outside, and you erase the oldest symbol. (That means there are always 180 unerased symbols left.)
- Then you count only the crosses. If there are 90 of them, you must leave the Schengen area before midnight unless the oldest symbol is a cross (because then you will erase that old cross tomorrow morning when you add a new one and get 90 crosses again).
- Repeat each morning. That's the key thing. Every single day, the check is "no more than 90 days from the previous 180 in Schengen."
There are some exceptions to this which allow longer stays, notably for holders of a D long-stay visa, and also "grandfathered" bilateral treaties between Canada and individual Schengen nations. For instance, you can spend days beyond 90 in Denmark, but days in Denmark early in the trip do count against those 90 days as far as other Schengen countries are concerned.