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

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

Although this is fixed in Python 2.6 (which changed time_t to 64 bits with VS2008), I would like to use 2.5 because many modules have already been compiled for it.

So, here is my question - is there any solution allowing my program to handle the year> 2038 and still use official Python 2.5? For example, some ready-made libraries, such as "time64"or "longtime", etc ...

Please do not tell me to upgrade to version 2.6+ or forget about the error - I have a reason to make it work, so I post a question here.

+5
source share
3 answers

The best solution I found is to get the original copy of Python 2.5 and recompile the time module with compilers that default from time_t to 64 bits, for example VS2005 or VS2008 (can also configure C runtime to prevent side by side problem).

+3
source

The module datetimein the standard library should work just fine for you. What do you need from a module timethat datetimedoes not offer?

+5

, :

  • Y2038 Python 2.5
  • Python 2.6 - 2038

: ( , )

Python 2.6 ( ) - 2030 2038 . , 2012 . , 2015 . , 2037 .

timestamp Python ( Python), , , :

  • Python 2.5, , Python 2.6 (-, " " )
  • (, "96" 1950 2049 , 2230 , "96", 1996, 2096 2196).

, 2038. /, , (, timestamp ).

+5

All Articles