-8

**Hi every one ...

Excuse me ,I am of a question , but I don't know what is it it's subject to ask..

I wanna know that when the System.currentTimeMillis() in java will became zero , I mean when it will start again ?**

Community
  • 1
  • 1
  • 4
    Do the math. It is a long, so you have 64 bits/1000 of seconds. You won't be around to worry about it. – jalynn2 Dec 23 '14 at 14:23
  • See http://stackoverflow.com/questions/2978452/when-will-system-currenttimemillis-overflow for some ideas on how to the calculation. – NPE Dec 23 '14 at 14:23
  • 2
    It'll wrap around in the year 292,278,994 so it should cover all use cases – Will Warren Dec 23 '14 at 14:24
  • The subject you're looking for is called [Arithmetic overflow](http://en.wikipedia.org/wiki/Arithmetic_overflow). Others have already provided resources with the concrete answer for your question. – Telmo Marques Dec 23 '14 at 14:26

1 Answers1

3
scala> new Date(Long.MAX_VALUE)
res1: java.util.Date = Sun Aug 17 07:12:55 GMT 292278994

So System.currentTimeMillis() will become negative in the early morning of Sunday August 7th, 292278994. It will take the same amount of time again (since the beginning of time in 1970) to get back to zero, i.e. some time in the year 584556019.

lmm
  • 17,386
  • 3
  • 26
  • 37