Eiffel and the Y2K38 bug?

by Emmanuel Stapf (modified: 2009 Apr 24)

Have you heard about the Y2K38 bug? If not, you should read the wikipedia entry about it. Is Eiffel immune of that problem? It depends on the platform and the C compiler you are using. The main two issues with time in the Eiffel libraries are:

  • The time stamp for files available through the FILE class.
  • The EiffelTime library queries to get the current time (e.g. {DATE}.make_now).

For the time stamp, regardless of your C compiler or platform, the FILE class will truncate the value since it is returning an INTEGER_32. So there is some work to be done there to get the INTEGER_64 value that most file system reports.

For the EiffelTime library, it is more complicated. For sure, if you are using a 64-bit platform you are immune since the C layer we use to query the time is always 64-bit. On 32-bit platform the story is a little bit more complicated. For example, on Windows, if you use an older version than Visual Studio 2005, then your code won't work, but if you use VS 2005 or above then it should work because the C compiler uses a 64-bit representation even on 32-bit platform. For 32-bit unices, it seems that you are out of luck and as far as I can see I'm not even sure they can handle the dates beyond 2038 properly.

To definitely avoid this problem, and if you haven't done so now, start developing 64-bit applications. It will certainly reduce your risk if you expect your code to run for the next 30 years or so.