Questions tagged [year2038]

The "Year 2038 problem", a.k.a. Unix Millennium Bug, affects systems that use a signed 32-bit integer for the number of seconds since the "unix epoch" or 00:00:00 January 1, 1970. For such systems, the maximum date they are capable of expressing is 03:14:07 January 19, 2038.

Many "unix-like" systems express the current system time as the number of seconds since 00:00:00 January 1, 1970. For systems that use a signed 32-bit integer, which has a maximum possible value of 2,147,485,547, the maximum possible date is then 03:14:07 January 19, 2038, at which time adding one second will cause an integer overflow and result in a negative number, which will correspond to a time in the year 1901.

This Wikipedia article describes it in full.

67 questions
6
votes
3 answers

time_t to boost date conversion giving incorrect result

I have a collection of unix timestamps I am converting to boost (1.65.1) dates but the conversions seem to break down when they get too far in the future. Anything around 2040 and beyond seems to be wrapping in some way back to post 1900. Given the…
aatwo
  • 948
  • 6
  • 12
5
votes
1 answer

Is it guaranteed to be 2038-safe if sizeof(std::time_t) == sizeof(std::uint64_t) in C++?

Excerpted from the cppref: Implementations in which std::time_t is a 32-bit signed integer (many historical implementations) fail in the year 2038. However, the documentation doesn't say how to detect whether the current implementation is…
xmllmx
  • 39,765
  • 26
  • 162
  • 323
5
votes
2 answers

Converting timestamps larger than maxint into datetime objects

I have some code for converting some timestamps stored as strings into datetime objects and noticed today exceptions when it converts dates with an int timestamp value greater than the max int. datetime.datetime.fromtimestamp(2147570047) for…
GP89
  • 6,600
  • 4
  • 36
  • 64
4
votes
1 answer

Visual Studio 2015/2017 Year 2038 bug with ftime functions

I am migrating some code from vc120 to vc140 and I am running into a problem with ftime64. The problem is similar to one mentioned on the Visual Studio dev community where ftime64 seems to have a year-2038 bug in 2015/2017 but where 2013 does…
syplex
  • 1,147
  • 6
  • 27
4
votes
3 answers

calendar time stored as a signed 32-bit integer - when will it overflow

I'm going through exercises from Advanced Programming in Unix and encountered the following question: If the calendar time is stored as a signed 32-bit integer, in which year will it overflow? positive signed integer = 2147483647 In the following…
dcrearer
  • 1,972
  • 4
  • 24
  • 48
4
votes
5 answers

Convert Epoch to DateTime SQL Server (Exceeds Year 2038)

How to convert Epoch to DateTime SQL Server if epoch exceeds the year 2038? Answer in Convert Epoch to DateTime SQL Server will not work. Example: SELECT DATEADD(ss, 2713795200000 / 1000, '19700101') Thu, 30 Dec 2055 16:00:00 GMT
Dobermaxx99
  • 318
  • 5
  • 16
4
votes
2 answers

Correct way to store MySQL date after year 2037

I am trying to store in MySQL a date() field a successive date to the year 2037. For example: 2065-12-01 Problem is that the field is returning: 1969-12-31 What is the correct way to record these values on DB? Should I use VARCHAR? I compute the…
Hid Dencum
  • 582
  • 4
  • 21
4
votes
1 answer

Handling Y2.036K & Y2.038K bugs

I am currently working on a project with a requirement that our software must operate until at least 2050. Recently we have run into problems dealing with the Y2.036K "bug" in the NTP protocol and also the Y2.038K bug. Basically, our software must…
S73417H
  • 2,661
  • 3
  • 23
  • 37
3
votes
3 answers

Time as a Signed Integer

I've been reading up on the Y2038 problem and I understand that time_t will eventually revert to the lowest representable negative number because it'll try to "increment" the sign bit. According to that Wikipedia page, changing time_t to an unsigned…
Maxpm
  • 24,113
  • 33
  • 111
  • 170
3
votes
2 answers

Why perl cannot convert unix timestamp over year 2038?

I am trying to use below perl command to convert epoch times to readable localtime: bash-3.2$ perl -le print\ scalar\ localtime\ 32503651200 Thu Mar 9 19:13:52 1911 Below year 2038 is possible to be converted correctly, but for year…
Fehan
  • 31
  • 3
3
votes
1 answer

PHP how can i localize date after 2038

i try to to use localized dates after 2038 with php strftime use Timestamp so it doesnt work after 2038 DateTime is not localized... So I try to use IntlDateFormatter with DateTime : $d = DateTime::createFromFormat('Y-m-d', '2040-01-01'); $fmt = new…
kspal
  • 31
  • 4
3
votes
2 answers

PHP date() fails for high timestamps on 32bit

I've stumbled upon this issue:
MightyPork
  • 18,270
  • 10
  • 79
  • 133
3
votes
1 answer

perl, int number of second since 1970

using an old release of EPrints software, i've this function EPrints::Time::datestring_to_timet to return an integer number of seconds since 1970 ###################################################################### =pod …
robert laing
  • 1,331
  • 2
  • 12
  • 19
3
votes
1 answer

32 bit ruby 1.9.2p290 Time can't handle 2038?

32-bit ruby 1.9.2p290 (which I must use), seems to be having a hard time with adding 25 (but not 24!) years to the current time. now = Time.now more_time = (24*365*24*60*60) puts "more_time.class = #{more_time.class}" later = now + more_time now =…
CHK
  • 532
  • 6
  • 18
3
votes
1 answer

Would there be any benefit of storing unix timestamp as unsigned integer?

I don't want to start another discussion of pro or contra between using DATETIME vs TIMESTAMP vs INT. (I've already read articles like Using MySQL's TIMESTAMP vs storing timestamps directly.) I sometimes use INT data type to store unix timestamps in…
rabudde
  • 7,498
  • 6
  • 53
  • 91