It depends. We've flown through Calgary many times, and it truly depends on many many factors. What time of the year are you going? What time of day are you going? Who's working? (this seems to be a major one...if someone working in customs is having a bad day, you could too!).
We've gotten through customs and security in 45 minutes before, but last time we went through Calgary, it took us 2 hours! And this was at 11pm!
To play on the safer side, we always arrive no later than 2 hours before departure. We get our boarding passes online and we check our bags online. We have all of our security stuff ready to go in ziplock bags, and we try not to pack anything that may seem "suspicious" to not get searched (however, I get searched every single time....no matter what! Once, I even went without a carry on, and I got randomly picked to get a full body search...go figure!).
If we get through security and we still have oodles of time, we get something to eat or a couple of beers and just wait it out. In our opinion, its way better to get there early than to miss your flight.