US and Canada share entry exit records. If you check your electronic I-94 at CBP website, you will see exit record from when you enter Canada with Canadian post's number on it. Even airlines share the information with CBP, so exits are automatically logged.