Unix时间和闰秒 [英] Unix Time and Leap Seconds

查看:77
本文介绍了Unix时间和闰秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Red Hat Enterprise Linux 4.


我刚读完了UTC和闰秒。


这是真的吗我的系统,Unix时间可能会跳过或减少一秒

午夜时有闰秒?


按Unix时间我的意思是time()和类似函数返回的整数。


我关心的是向下案件。我写的一些软件

假设单调增加时间。


谢谢。

-

David T. Ashley(dt*@e3ft.com)
http:/ /www.e3ft.com (咨询主页)
http:// www .dtashley.com (个人主页)
http://gpl.e3ft .com (GPL出版物和项目)

解决方案

2007年6月23日星期六01:04:46 -0400 David T. Ashley说


我的系统是否真的是Unix时间可能会跳过或减少一秒

午夜时有一个飞跃第二个?


按Unix时间我的意思是time()和类似函数返回的整数。


我关心的是向下案件。我写的一些软件

假设单调增加时间。



我认为你不用担心。


(1)NIST说基于我们的知道地球的自转,似乎我们不太可能有一个负的闰秒。

< http://tf.nist。 gov / general / leaps.htm#Anchor-52904>


(2)如果确实发生了,时间会重复,而不是倒退。


Sig


-
http://koiclubsandiego.org/comment/?r=8

9b9a436ac9285567ef58d7d6a4dbb750


David T. Ashley写道:


我有红帽企业Linux 4.


我刚刚读了关于UTC和闰秒的内容。 />

在我的系统上,Unix时间可能会跳过或减少一秒

在午夜有闰秒时是真的吗?


通过Unix tim E"我的意思是time()和类似函数返回的整数。


我关心的是向下案件。我写的一些软件

假设单调增加时间。



夏令时(虽然一次又一次拨打电话可以节省日光 - 那么

将与当天的日光量完全相同而不管什么

你叫小时 - 我还在努力解决)在配置

文件(mefinx)中指定并且很少改变。闰秒我不太确定 - 他们

似乎是半随机添加的(当极其常数和

准确时(对于某些准确的定义) )原子钟的日子落后于地球旋转日减慢的时间。


闰秒意味着你的时钟快1秒。


我个人认为你可能更关心使用时间服务器

同步计算机的时钟 - 这台电脑的时钟例如,相当多地获得
,因此每次重新调整它都会向下调整它。


如果你有软件假定单调增加时间,我会

建议您使用时钟丢失时间的电脑(即它在1.00001点上$
秒,而不是这台电脑的0.99999秒)这样当你的时钟重新同步

时,它总会向上调整。此外,在GHz处理器上,无论如何,
秒相当粗略。


David T. Ashley写道:


我有红帽企业Linux 4.


我刚读完UTC和闰秒。


我的系统是否正确,Unix时间可能会跳过或减少一秒

午夜时有闰秒?


按Unix时间我的意思是time()和类似函数返回的整数。


我关心的是向下案件。我写的一些软件

假设单调增加时间。


谢谢。



编程错误。例如,如果

服务器上的时钟被更正,会发生什么?回来五秒钟(可能因为它正在运行

快)?


-

====== ============

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================


I have Red Hat Enterprise Linux 4.

I was just reading up about UTC and leap seconds.

Is it true on my system that the Unix time may skip up or down by one second
at midnight when there is a leap second?

By "Unix time" I mean the integer returned by time() and similar functions.

I''m concerned about the "down" case. Some of the software I''ve written
assumes monotonically-increasing time.

Thanks.
--
David T. Ashley (dt*@e3ft.com)
http://www.e3ft.com (Consulting Home Page)
http://www.dtashley.com (Personal Home Page)
http://gpl.e3ft.com (GPL Publications and Projects)

解决方案

On Sat, 23 Jun 2007 01:04:46 -0400 David T. Ashley said

Is it true on my system that the Unix time may skip up or down by one second
at midnight when there is a leap second?

By "Unix time" I mean the integer returned by time() and similar functions.

I''m concerned about the "down" case. Some of the software I''ve written
assumes monotonically-increasing time.

I don''t think you have to worry.

(1) NIST says "Based on what we know about the earth''s rotation, it seems
unlikely that we will ever have a negative leap second."
<http://tf.nist.gov/general/leaps.htm#Anchor-52904>

(2) If it did happen, the time would repeat, not go backwards.

Sig

--
http://koiclubsandiego.org/comment/?r=8
9b9a436ac9285567ef58d7d6a4dbb750


David T. Ashley wrote:

I have Red Hat Enterprise Linux 4.

I was just reading up about UTC and leap seconds.

Is it true on my system that the Unix time may skip up or down by one second
at midnight when there is a leap second?

By "Unix time" I mean the integer returned by time() and similar functions.

I''m concerned about the "down" case. Some of the software I''ve written
assumes monotonically-increasing time.

Daylight saving (though how calling one time another saves daylight - there
will be exactly the same amount of daylight in the day regardless of what
you call the hours - I''m still trying to work out) are specified in a config
file (mefinx) and rarely change. Leap seconds I''m not so sure about - they
seem to be added semi-randomly (as and when the extremely constant and
accurate (for some definition of accurate) atomic clocks'' day gets behind of
the slowing down earth rotation day).

Leap seconds will then mean that your clock is 1 second fast.

Personally I think you''ve probably got more concern from using a time server
to sync your computer''s clock - the clock in this PC, for example, gains
quite a bit and so resyncing it adjusts it downward every time.

If you''ve got software that assumes monotonically increasing time, I''d
recommend you get a PC with a clock that loses time (ie it ticks at 1.00001
secs, as opposed to the 0.99999 secs of this PC) so that when re-syncing
your clock it will always adjust upwards. Besides, on a GHz processor,
seconds are rather a coarse measure anyway.


David T. Ashley wrote:

I have Red Hat Enterprise Linux 4.

I was just reading up about UTC and leap seconds.

Is it true on my system that the Unix time may skip up or down by one second
at midnight when there is a leap second?

By "Unix time" I mean the integer returned by time() and similar functions.

I''m concerned about the "down" case. Some of the software I''ve written
assumes monotonically-increasing time.

Thanks.

Bad programming. What happens, for instance, if the clock on your
server is "corrected" back five seconds (possibly because it''s running
fast)?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


这篇关于Unix时间和闰秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆