I've written a couple of modules for Drupal. I'm going to post them here, but the good ones will end up at Drupal.org.
This is a Drupal 5.1 module that counts hits to your site. It counts "all time" hits from the moment the module is installed. It requires Cron and the Access Log to be enabled (part of the Statistics core module).
Once installed, the module counts hits since the last time it ran each time cron runs. In other words, it updates the total each time cron runs. It can display the hit count in a block, optionally saying how many hits per week/month/day etc, and optionally saying when the counter started. For example:
1234 hits, 567 per month, since March 2007
1234 hits since 22:03 March 17th, 20079
For cheaters, the module allows the administrator to say how many hits the site's had, and even when the module was installed (otherwise these get set automatically when cron first runs after the module is installed).
For want-to-be developers, this module is pretty simple and pretty well commented. If you're looking for a real example of Drupal 5 or Drupal 6 modules, this might be a good start.