I was watching today.Python APIwhen, see TimeModule:
The epoch is the point where the time starts. On January 1st of this year, at 0 hours,the "time since the epoch" is zero. For Unix, the epoch is 1970. To the "What's The epoch is", look at Gmtime (0).
Defined Timefrom1970years1Month1Day began, and suddenly thought inJAVAinside,OracleThe database time is also1970
years1Month1Day start calculation. LikeJavaClass Code
Date date = new Date (0);
SYSTEM.OUT.PRINTLN (date);
Print out the results:
Thu Jan 08:00:00 CST 1970
Also1970years1Month1Day, in fact, seconds and minutes are0Point0points0seconds(printed here is8Point, will explain later).
Why this time is defined in1970years1Month1This time of day??
So it started.Google, the Chinese webpage can't find the answer at all. So try to search the English keyword,in theSun Javathe forum finally found an accurate post:
Http://forums.sun.com/thread.jspa?threadID=595140&start=15
One of the replies:
I suspect that Java is born and raised on a UNIX system.
UNIX considers the epoch (when do time begin) to is midnight, January 1, 1970.
is to sayJavaoriginated inUNIXsystem, andUNIXThink1970years1Month1Day0Point is the time era.
But that's still not a good explanation."Why",out of curiosity, continueGoogleand finally found the answer.:
Http://en.wikipedia.org/wiki/Unix_time
The explanation here is:
The initial computer operating system is +bit, and time is also used +bit representation.
System.out.println (Integer.max_value);
2147483647
Integerin theJAVAInternal Use +-bit representation, so +the maximum value represented by the potential energy is2147483647. Other than that1years365the total number of seconds of the day is31536000,
2147483647/31536000 = 68.1
Other words +The maximum amount of time the potential energy represents is theyears, and actually to2038years onMonth +DayGenevawhen -points07
seconds, it will reach the maximum time, over this point in time, all +bit operating system time will change to
10000000 00000000 00000000 00000000
Which means 1901.years12Month -Day20when $points theseconds, so there will be time regression, and many software will run out of the ordinary.
Here, I think the answer to the question has come out.:
Because with +the maximum interval for a bit to represent time is theyears, and the first to appearUNIXthe operating system takes into account the calculation
The time of generation and application of the machine .1970years1Month1Day asUNIX TimeThe epoch Time(start
Time), whileJavaNature also follows this constraint.
As for the phenomenon of time regression believe that with -is gradually being addressed for the operating system, as --bit operation
The system can represent the292,277,026,596years12Month4Day15when -points ,seconds,
Why the programming language and database are to be calculated starting from January 1, 1970