DIY: Billion Second Birthday

posted December 17th, 2007 by Shannon

Want to know when your billion second birthday is (or was)? Want to say you’ve written a bit of Ruby code? Well, here’s your chance. Head over to this Interactive Ruby site and type this line (substituting your own birthday year, month, and day):

Time.mktime(1980,8,13) + 1000000000

You will have to type it out. Copy and paste does not work, sorry! If you know the hour and minute of your birth you can add those inside the parentheses after the day. (You’ll need to use 24-hour time for the hours.) Your line would instead look like this:

Time.mktime(1980,8,13,15,16) + 1000000000

If you want to play around some more, hit your up arrow key to bring up your last line of code. Take of 3 of the zeros and see when your millionth second birthday was.

So, what do you think? Did you try it? Did it work? (Did you get an error?) Let me know.

NOTES: The birthday listed above is not MY birthday. Though I do know someone with that birthday. I don’t know the hour and minute of her birth so I made that part up. The tutorial on the interactive ruby page is not one I’ve been all the way through. But if you want to try it out for a bit, be my guest. And tell me what you think of Ruby!

7 Responses to “DIY: Billion Second Birthday”

  1. My billion second birthday was Tuesday May 11, 2004 at 11:18:40 pm. Now, bonus points for anyone who does not already know my birthday if they can figure out when my birthday was!

  2. Ok, here’s a scenario, pretend it’s April Fool’s Day 2014. If I told you I was a billion seconds old, would I be telling the truth or playing a joke on you???

  3. Hmm, well I tried to figure out my 1 trillion second birthday, but it no worky. Threw an out of Time range error. So I was curious and dug a little deeper.

    Turns out that it’s using a 32bit size integer to store the seconds value. That means the largest possible value is 2^31—1 (aka 2,147,483,647 ). Since date calculations are made based on Jan 1, 1970 (the epoch), the most you can go is to Tue Jan 19 03:14:07 2038. That’s with starting at the epoch. If you start past the epoch, then it’s even less.

    In Java we do date calculations using a 64 bit value. That’s 2^63—1 (or 9,223,372,036,854,775,807), so I won’t run into this problem for some time.

    Ok, now bring on your nerd comments. I’m secure in my nerd-hood.

  4. George, I have no idea what you are talkng about. Does that make you a nerd or me out of it?

  5. George, I have some punch cards – they have 80 columns. That is over 64, so maybe you can calculate 1 trillion using the punch cards. Instead of Ruby, maybe Emerald will work, especially if you drink a lot of Java. Hope this helps.

  6. Since we are talking birthdays, (the calendar DAY of one’s birth) today is my 730th.

    old joe

  7. Old Joe – Welcome!!! So nice to ‘see’ you here! 730, huh? Man, that’s a lot of months! I guess you are pretty old!!
    (Just kidding – we love you – thanks for stopping by and commenting!)

Leave a Reply