I have a web app which orders stuff using a timestamp, which is just a long. My web app backend happens to be written in java, so I am using:
long timestamp = System.currentTimeMillis();
what year (approximately) will this fail? I mean at some point, the range of a long is going to overflow, right? We may all be long-dead, but I'm just curious. Will it be like y2k all over again? What can I do to prepare for this? Ridiculous, I know, just curious!
It will overflow at
System.out.println(new Date(Long.MAX_VALUE));
which prints
Sun Aug 17 03:12:55 GMT-04:00 292278994
That's thus after a bit more than 292 million years. I'd say, there's a plenty of time to invent a solution in the meanwhile. To be honest, I don't expect the humanhood to survive this. We exist only a few seconds as compared to the age of the world in hour scale and it won't take long.