Can anyone think about the practical use of XMLGregorianCalendar.getEon ()?

I met the XMLGregorianCalendar class some time ago, and I was impressed with how the GregorianCalendar looked easy .;)

I recently noticed the BitInteger getEon() method, which puzzled me.

From Javadoc for XMLGregorianCalendar

getYear () is the value between - (10 ^ 9-1) - (10 ^ 9) -1 or DatatypeConstants.FIELD_UNDEFINED. getEon () is a year value with a high order of a billion years.

It occurs to me that, as the length of the day on Earth varies significantly over millions of years, and there the number of days in a year has changed. The Gregorian calendar does not make sense a billion years ago or a billion years. Thus, getEon () can be reasonably set to 0 or left undefined, which has the same result.

My question is: did I miss something? Is there any reasonable use of the getEon() method?

+6
source share
1 answer

Well, according to http://www.merlyn.demon.co.uk/critdate.htm , unix time using an integer of 64 bits will end within 3E11. Given that Java uses milliseconds instead of seconds, Java time (64 bits) ends at 3E8. Thus, it provides some expansion beyond the JVM.

In a more practical note, when you use this timeline, you are talking about geological, evolutionary or cosmological events, so the rest of the data in the date (year, month, day ...) is meaningless. It is better if you use a long one with a year (or even an int with an en) and forget about everything else.

It seems like someone really was really boring (and boring).


Edit: Of course, there are always some crazy problems that can use it, but not problems with the real world (as in: β€œif we have Hanoi towers with 64 discs and move the disc for a second when we finish replacing the tower”).

+4
source

Source: https://habr.com/ru/post/890754/


All Articles