Thursday 10 May 2007

The Mythical 1.44MB floppy

Well, the days of 3 1/2" floppies have long since passed (for most of us), although I'm sure 5 1/4" floppies are still being used... somewhere. Anyway, now is as good a time as any to explain why 1.44MB floppies never have been that size, and never can be.

To start off, a 1.44MB floppy has a capacity of exactly 1,474,560B. Wait a minute! Isn't that 1.47MB? Well, yes, if you use SI units (1 megabyte = 10^6 bytes). Isn't that 1.41MB? Think those of you to whom a megabyte is 2^20 bytes. But hey! Under neither definition of a MB does the 3 1/2" floppy fit!

Why?

Whoever called it the 1.44MB floppy decided that a kB was 1024 bytes, while a MB was 1000kB (1,024,000 Bytes). Multiply by 1.44, and behold! 1,474,560 bytes.

Isn't that crazy?

Monday 7 May 2007

Timezone Information on Windows

I was trying to find out how to grab the current timezone settings from the Windows registry, so I searched on the Internet, and eventually found where it was stored

(HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation)

, but most sites that showed the data structure were wrong. Only with one thing, that was which 16 bit integer represented the day of the week. Most sites said it was the 3rd Integer, but actually, it is the 8th (or last) Integer in the keys "StandardStart" and "DaylightStart". Eventually I found a site that said the right thing, so I'm going to list it here anyway.

 

Path: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
Keys: StandardStart and DaylightStart
All integers are two byte big endian
Integer IndexRepresents
0Year: 0 = 1900
1Month: 1 = January ... 12 = December
2Week: 1 = First week ... 5 = Last Week
3Hour: 0 = Midnight, 23 = 11pm
4Minute: 0 - 59
5Second: 0 - 59
6Millisecond: 0 - 999
7Day of week: 0 = Sunday ... 6 = Saturday

 

So, there you have it.