﻿# V795\. Size of the 'time\_t' type is not 64 bits\. After the year 2038, the program will work incorrectly\.

The analyzer has detected that a program uses 32\-bit data types to store time\. This issue will affect those programs that use data types representing the number of seconds elapsed since January 1\-st, 1970\. After January 19\-th, 2038, such programs will no longer be able to represent dates correctly\. It is recommended that you use 64\-bit types to store time\.

The size of the 'time\_t' type is not specified by the C/C\+\+ standard, so it can be defined differently depending on the platform and the project's settings:

```cpp
typedef /* unspecified */ time_t;
```

In older versions of Visual C\+\+, the 'time\_t' type was 32\-bit in 32\-bit Windows versions\. Starting with Visual C\+\+ 2005, it is a 64\-bit integer by default\. Modern Visual C\+\+ versions allow you to force the use of the 32\-bit version of 'time\_t' by using the '\_USE\_32BIT\_TIME\_T' directive\. You should discard this directive wherever possible and use the 64\-bit 'time\_t' type instead\.

In Linux, 'time\_t' is 64\-bit only in 64\-bit versions of the operating system\. Sadly, 32\-bit Linux systems do not provide any regular means to make it 64\-bit at present\. If that is your case, consider replacing 'time\_t' with third\-party solutions\.

References:

1. [2038: only 21 years away](https://pvs-studio.com/en/blog/posts/cpp/0505/)
1. [Year 2038 problem](https://en.wikipedia.org/wiki/Year_2038_problem)
1. [https://msdn\.microsoft\.com/en\-us/library/w4ddyt9h\.aspx](https://msdn.microsoft.com/en-us/library/w4ddyt9h.aspx)