Saturday 14 February 2009

A great second in unix time

So how many partied like it was 1234567890 last night? I must confess I watched the once in a life-time moment tick past after watching a bit of Doctor Who on iplayer.

What am I talking about? Ok...

Unix time is measured from what is commonly know as the "epoch" or "Unix Epoch" which started on 1st January 1970, before my time. Unix system time is measured in seconds since the epoch and at 23:31:30 GMT on Friday 13th Feb this year (2009) unix time ticked over to 1234567890 seconds since the epoch - how cool is that?

There were parties all over the world, sadly none near me - not that I would have gone with this dose of what ever it is making my nose run like the mississipi (slow and muddy - lets not go there). Is all this a bit sad? Well as one person pointed out in this article from the Times:
"Celebrating the millennium - why do that? It was just like any other day, the Earth rotates on its axis and it moves around the Sun. All these things are arbitrary, so for geeks to celebrate Unix time is something for them to enjoy."
Well said! However staying with the same article I really have to pick fault with it - that's the media for you can't get anything right.

"The problem with a 32-bit integer like this is that it can only count 4,294,967,296 seconds, or 136 years."
Err... hang on... reaching for calculator... yup 2^32=4,294,967,296, divide by 60 for seconds in a minute, divide by 60 again for minutes in an hour, divide by 24 for hours in a day and 365.25 for roughly days in a year counting leap years = 136.1 (rounded) ok so they are doing well in their maths so far... or are they? This is where a number of issues arise. Let's look to start with at the maximum count.

To simplify the problem lets work on a 4 bit integer, no signing (all that messy 2's compliment is a pain). Our maximum unsigned integer value is 1111 = 8 + 4 + 2 + 1 = 15 and it's 4 bit so 2^4=16 ... hoooooooold on a minute! So maximum value looks like (2^n)-1 ok that's not really going to cause many problems on our calculation considering we were rounding like goodun's anyway - what's the difference between 4,294,967,296 and 4,294,967,295 other than that it will be the 4,294,967,296th second where the clocks have turned. And the poster at the bottom of the article who claimed the maximum integer was 2,147,483,647 was working on a 31 bit register for some reason - why use signing when it's not needed?

So that's knocked a second off the time till the much awaited "epochalypse" hey ho, I can't say I'm too bothered. However - the date claimed in the Times was sometime in January 2038... that seems quite soon doesn't it? The quote being:
"...136 years. This covers a period between 1901 and 2038."
As a good friend once said "WTF?", where did 1901 suddenly come from - hold on! this person's done the "Introduction to Microsoft Excel" course haven't they. If you type 1 into a cell in Excel and format it as a date you realise excel starts at 1/1/1901. But they just said unix time starts at 1/1/1970 so that takes us to 2106 (sometime in January I guess). AHA! So microsoft will bring about the end of the world before unix - there's no surprise.

Edit: I'm going to add an edit in here rather than re-writing the rant above. I just realised that using a signed integer you could say that pre-time (i.e. negative numbers) goes back to sometime in december 1901 - 2,147,483,647 seconds before 1/1/1907 and then yes the "epochalypse" is indeed scheduled for 2038 (03:14:07 on January 19th to be precise). You can even buy the t-shirt

Anyway, everything's shifting onto 64 bit architecture which gives something in the region of 584.5 billion years (not 294 as the Times incorrectly states) - nice - considering in a 100th of that time our sun will be a red-giant with radius greater than the current radius of the Earth's orbit, I'm not really going to worry overly.

It does irritate the hell out of me though when the media, particularly well thought of branches of the media such as the Times cannot get its facts straight or miss out vital pieces of information. Also sentences like:
"It's the same principle as the millennium bug, but one that many scientists believe should be be taken more seriously, as only people who count in binary will see it coming."
/facepalm, I personally grow weary of the "boffin" image for starters (this article in wikipedia sums it up for me) - it's so Pathe News. And what the hell does the above sentence mean anyway? Add the word "scientists" to a news article to give it the necessary gravitas for Joe Public not to question it then put them down by telling them they can't count in binary - gods talk about repressing the masses - binary counting is not hard, I could do it when I was 4 (see profile picture) its just that most people don't need to count in binary. If hexidecimal was the commonly used number system then we'd all count in base 16 and every one would think decimal difficult and weird.

I'm going to stop ranting about media conspiracies and repression of the masses now as it's not even 10am on Saturday morning and its getting that 1984 feeling already.

People I will leave you to the glorious uncertainty of existance with one word of warning Do not believe everything you read in the papers (particularly if it's about something scientific).

No comments:

Post a Comment