Do you suffer from a morbid fear of death?

Then this is probably not for you. One of my favorite toy programs has been to write code to compute my age, in days, and print it out every time I login. When I login I see the following:

Birthday: February 2, 1968
Today is February 21, 2001 and you are 12073 days old.

How cool is that, eh?

This new version, written in record time, uses the excellent libdate library to do the date calculations, rendering the code utterly trivial.

If you want, grab the code, build the library, and then run it with your birthday as an argument, e.g.:

days 1976 4 27

View Code (HTML formatted w/syntax highlights)

  • days.c
  • Download

  • Linux binary, x86, static link
  • days.c
  • makeme script
  • libdate library

  • Back to code page

    Back to home page