Is save to use System.currentTimeMillis() after 2038?

742 Views Asked by At

The Year 2038 problem (also called Y2038 or Unix Y2K) relates to representing time in many digital systems as the number of seconds passed since 00:00:00 UTC on 1 January 1970 and storing it as a signed 32-bit integer. Such implementations cannot encode times after 03:14:07 UTC on 19 January 2038. Just like the Y2K problem, the Year 2038 problem is caused by insufficient capacity of the chosen data type.

(source Wikipedia)

I tried to search how this affect Android and its applications. But I didn´t find any clear answer about this. Therefore I would like to ask here:

Can we expect any problems in future (in 2038 and later), if our programs will use System.currentTimeMillis() method?

Are they any dangerous method we should avoid?

1

There are 1 best solutions below

1
Michael On

System.currentTimeMillis() returns a long, a 64 bit integer, so you'll be safe until the year 292278994.

Luckily, we'll all be dead by then.