Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are the new Delphi XE2 autogenerated build numbers linked to 1.1.2000 00:00:00?

In Delphi XE2 the automatically generated build numbers functionality now uses some kind of date and time generated values, like this:

2.4.4386.838

The last two numbers change each time you build and are based on the current date and time:

Major = 2 (user defined)
Minor = 4 (user defined)
Release = 4386 (number of days since Jan 1 2000)
Build = 838 (number of seconds since 00:00:00)

I guess this new format for Release and Build numbers was borrowed from the .NET implementation which does something very similar. In .net, the last number (Build) is equal to the number of seconds since midnight local time, divided by 2. See this link for details on .net implementation: Determining Build Date the hard way

If this can be relied upon to stay this way, then now we have a better way to determine the compilation time instead of

  1. Using IDE plugins

  2. Using PE Headers hacks

The questions is not how to return to the old autoincrement version numbers functionality.

The questions is does XE2 really use the date and time as I showed above, starting from Jan 1, 2010 and adding days and seconds in Build and Release numbers?

like image 254
Gad D Lord Avatar asked Jan 03 '12 22:01

Gad D Lord


1 Answers

The encoding cannot be what you think it is. The release and numbers are packed into a single 32 bit DWORD. That means that there are only 16 bits available for all the seconds in a day. There are 86400 seconds in a day which is greater than 216.

Rather oddly the Delphi implementation appears to wrap around when it reaches 216 seconds, ~18.2 hours. So at the moment, it is 22:50 in my time zone (UTC), but the auto generated release number is 16753, or around 4.6 hours. Add back the missing 18.2 hours from the wrap around and bingo, it's 22:50.

It looks like the Visual Studio people got it right, because they took the number of seconds after 00:00 and divided by 2. It would also appear therefore that the Delphi auto generated release numbers will not be monotone increasing with time, will not be unique and so on.

This seems to me to be a bug which I have submitted as QC#102343. Note that the bug was introduced in XE2 update 3. It was not present in previous versions. Note also that the handling of the release number has changed from update 2 to update 3.

like image 99
David Heffernan Avatar answered Sep 20 '22 07:09

David Heffernan