This post has already been read 1620 times!

Since a time_t is only required to represent time intervals of ±68 years, and many implementations use a base year of 1970 for representing the current time, there is an inability for many popular C++ implementations to represent dates and times after 2038. This means that a lot of software could break in 2038, if programmers don’t take adequate precautions.

The time function returns a time_t type, which is an implementation-defined arithmetic type for representing a time period (a.k.a. a time interval) with at least a resolution of one second. The largest time interval that can be portably represented using a time_t is ±2,147,483,648 seconds, or approximately 68 years. A call to time(0) returns a time_t representing the time interval from an implementa-
tion defined base time (commonly 0:00:00 January 1, 1970) to the current moment.

Comments are closed.

Post Navigation