Year 2038 limitation on HP-UX and recommended steps
The year 2038 limitation is a known limitation on most UNIX® and UNIX®-like operating systems. This document describes the year 2038 limitation on HP-UX, technical solutions provided by HP, and our recommendations to overcome this limitation.
Year 2038 limitation
UNIX and UNIX-like operating systems (such as Linux) calculate system time as the number of seconds since January 1, 1970, which is internally considered as 00:00:00. However, in 32-bit applications, a 32-bit object is used to store the time that will overflow when a date of January 19, 2038 is reached. This will make the system clock appear to revert back to 1901 for 32-bit applications, thereby creating calculation errors. On systems other than HP-UX 11i, the symptoms may be different depending upon the implementation. Recently, this limitation started to appear in those 32-bit applications that are making future date calculations extending to 2038 and beyond. Due to the larger object sizes, this limitation will not occur with 64-bit applications.
In 2038, 32-bit applications conducting date calculations based on the system clock will appear to revert back to the year 1901. Therefore, these applications will require modification before 2038 to overcome this documented limitation.
This is an industry-wide phenomenon for 32-bit UNIX applications affecting numerous variants of UNIX.
HP solution and recommendations
In 1997, HP introduced its first version of 64-bit HP-UX that provides industry leading capabilities for 64-bit computing. This includes the support of industry-standard date functions for 64-bit applications that compute dates beyond 2038.
In 2038, HP-UX 32-bit applications using industry standard date functions will revert back to the year 1901. Currently deployed 32-bit applications making date calculations for 2038 and beyond will also encounter this calculation limitation. For applications that may still be operational and using these functions in 2038, the solution is to rebuild it as a 64-bit application in order to change the definition of time_t to a 64-bit data type.
Additionally, a new set of interfaces is available for 32-bit applications that cannot be converted to 64-bit, but have immediate critical needs to compute dates beyond 2038. This new interface is available now and allows customers to modify the code to compute dates through the year 9999.
This new interface is available on HP-UX 11i v3 as patches, PHCO_38658, PHCO_38658 and PHCO_38658. It can be downloaded at HP’s IT Resource Center. Applications that are modified to use these enhanced interfaces are still subject to the apparent system clock wrap around that will happen in 2038 and will need to be rebuilt as a 64-bit application by that time.
Frequently Asked Questions
The following are commonly asked questions on using 64-bit versus 32-bit mode. The HP-UX 64-bit Porting and Transition Guide provides more detailed information.
- Why use 64-bit? R/ Applications that need to address more than 4 GB of memory will need to migrate to the 64-bit mode. Many applications have now migrated to 64-bit and some are only available in the 64-bit mode.
- What are the disadvantages of using 64-bit, if any? R/ There may be an impact to the application’s performance caused by increased cache misses due to the larger addressable memory. The impact of this performance may vary from one application to the other.
- How to migrate 32-bit applications to 64-bit? R/Please refer to Chapters 3, 4 and 5 of the HP-UX 64-bit Porting and Transition Guide.