epoch time

来源:互联网 发布:杭州谷川服饰好吗知乎 编辑:程序博客网 时间:2024/05/20 14:42

The Unix epoch (also known as Unix Time Stamp) is the representation of time as the number of non-leap seconds since 00:00:00 UTC on January 1, 1970, introduced by the Unix operating system, standardised in POSIX, and later adopted by the Java programming language and JavaScript. Because many computers today store the number of seconds as a 32-bit signed integer, the Unix epoch is often said to last 231 seconds, thus “ending” at 03:14:07 Tuesday, January 19, 2038 (UTC).

In POSIX conforming systems, the type time_t is often used to represent times. It is an arithmetic type in the C programming language. There is no requirement that time_t be a 32-bit quantity (it could be a 64-bit integer or a floating point in double format), but most systems define time_t as a signed 32-bit integer, and many application programs may assume it, or may store values in a 32-bit type. A signed 32-bit integer type can represent numbers ranging from -2^31 to 2^31 - 1, that is, -2,147,483,648 to 2,147,483,647. In this format, time_t will run out of positive integers 231-1 seconds (that is 24855 days, 3 hours, 14 minutes and 7 seconds) after the Epoch, in the year 2038, and thus cannot represent times beyond that point. Programs which must handle times beyond the rollover date will need to be changed to accommodate a shift from 32-bit to 64-bit representation, not unlike the Year 2000 problem. Adapting existing programs may be as easy as re-compiling them with header files that declare time_t as a 64-bit integer, but other programs make deep assumptions as to the nature of time_t. In fact, some claim that the expiration of the Unix epoch timeframe may cause more damage than was predicted for the Y2K bug. Compiling time_t as a 64-bit signed integer will allow representation of all points in time 292 billion years before and after 1/1/1970.

To get the current Unix Time Stamp from your unix workstation use “date +%s” from a teminal.

 

refer to :http://www.techmount.com/index.php/20040830/epoch-time-unix-time-stamp

原创粉丝点击