How does DOS work out the volume serial number?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tom1000000

How does DOS work out the volume serial number?

Post by tom1000000 »

Hello,

I am probably being lazy and  could find this info out if I could get hold of an open source format utility,  but I'll ask anyway.

In the FAT specification it says the volume serial number is a 32bit value derived from the current date and time. It would have been really nice if they gave an example.

So if a disk is formatted at 2003 July 4, 12:15:34pm, how is that date / time converted to a 32 bit value by DOS??

Thanks!
Anton

RE:How does DOS work out the volume serial number?

Post by Anton »

You can do it any way. The main point is that this number is unik. So any system which sets this value should set it in some way, that there is very low probability that this number repeats.
Anton.
carbonBased

RE:How does DOS work out the volume serial number?

Post by carbonBased »

I wouldn't be surprised if it's the same way Unix (and C) do it; as the number of seconds that've passed since January 1, 1970 (I believe that's the date they use).

Cheers,
Jeff
User avatar
kataklinger
Member
Member
Posts: 381
Joined: Fri Nov 04, 2005 12:00 am
Location: Serbia

RE:How does DOS work out the volume serial number?

Post by kataklinger »

The first part of the serial number is equal to the sum of the time
(seconds and hundredths of a second) and the date (month and day);   The
second part of the serial number is equal to the sum of the time (hours
and minutes) and date (year), where all numbers are in hex.  For
example, if the diskette is formatted at 8:32:43.65 on 7/21/1991, the
first part of the serial number will be 2B41+0715, or 3256;  the second
part of the serial number will be 0820+07C7, or 0FE7.


By some Ray
Post Reply