Out.println (Session.getlastaccessedtime ()); The return value is the yarn meaning???

Source: Internet
Author: User
Tags epoch time

Out.println (Session.getlastaccessedtime ()); This statement is the output of the last successful acquisition of the session object attribute value of an instruction, his return value is a long type of data, The specific value is 1448334229658.

In fact, now you see that the long data is changing at any time, this number is the date of the 2015-11-24 11:04:02 when the data, and then the detailed explanation is 2015-11-24 11:04:02 from 1970-1-1 0:0:0 of the number of milliseconds.

Why is this time? Not only here, but in many other programming languages as well as the Oracle database, the 1970-1-1 0:0:0 as the time origin, what happened at this time? Here's a look at the report coming in front of you ...

The online explanation says:

Javaoriginated inUNIXsystem, andUNIXThink1970years1Month1Day0Point is the time era.But that's still not a good explanation."Why",out of curiosity, continueGoogleand finally found the answer.:

The first computer operating system is a three-bit, and the time is also expressed in the four-bit.

System.out.println (Integer.max_value);

Result is 2147483647

The Integer is represented in JAVA with the number of digits, so The maximum value represented by the 2147483647. In another 1 years The total number of seconds 365 days is 31536000,

2147483647/31536000 = 68.1

That is, the maximum amount of time is a year, and actually to 2038 years Day Geneva when - points - seconds, it will reach the maximum time, over this point in time, all + bit operating system time will change to

10000000 00000000 00000000 00000000

that is , the 1901 year of the month , the second minute, In this way, there will be time regression, and many software will run abnormally. 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 calculationThe time of generation and application of the machine .1970years1Month1Day asUNIX TimeThe epoch Time(StartTime), whileJavaNature also follows this constraint.

64 64 bit operation 292,277,026,596 year 12 month 4 day 15 30 sub 08 seconds, believe us. n Span style= "font-family: the song Body;" > descendants, which

Out.println (Session.getlastaccessedtime ()); The return value is the yarn meaning???

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.