Python – How to use time > year 2038 on official Windows Python 2.5

pythonpython-2.5timetime-tyear2038

The official Python 2.5 on Windows was build with Visual Studio.Net 2003, which uses 32 bit time_t. So when the year is > 2038, it just gives exceptions.

Although this is fixed in Python 2.6 (which changed time_t to 64 bit with VS2008), I'd like to use 2.5 because many modules are already compiled for it.

So here's my question – is there any solution to easily let my program handle year > 2038 and still using official Python 2.5? For example some pre-made libraries like "time64" or "longtime" etc…

Please do not tell me to upgrade to 2.6+ or forget about the bug – I have my reason to need to make it work, that's why I post the question here.

Best Answer

The datetime module in the standard library should work fine for you. What do you need from module time that datetime doesn't offer?