Leap second happening

Have anybody heard about the Leap second problem

Leap second :A leap second is a one-second adjustment that is occasionally applied to Coordinated Universal Time (UTC) in order to keep its time of day close to the mean solar time.

How could i avoid such thing in my script which i deal with times

source :Leap second - Wikipedia, the free encyclopedia

What problem do you expect your script to run into because of a leap second? How does your script handle the leaps caused by daylight saving time?
Usually a leap second should not be a problem. Is the box you run your script on using ntpd or xntpd to synchronize time? If so you can configure it to synchronzie slowly. Have a look at ntpd.drift.

My old HP-UX 11.11 server survived.

From /usr/adm/syslog/syslog.log:

Jul  1 01:00:01 unidev xntpd[1601]: leap second occurred, stepped time back 1 second

Interesting - POSIX ignores leap seconds. I do not remember, but it looks like HPUX does not play POSIX. I left HPUX with v11.

I would not worry about it. You will notice that timekeeping structures like struct stat and struct tm (standard C, which is the basis of timekeeping in UNIX) are leap-second aware.

Leap seconds are kept by Linux. And shells there are compliant with it. This is true only if the box is connected to an ntp service. Tracking leap seconds is not required by POSIX, so your OS may not care. What OS do you have?

Unless you are doing precision time keeping like GPS, Realtime device monitoring, or Astronomy, it will NOT break what you are doing. Since you asked the question, I'm pretty sure you cannot be involved in something that would be affected in any way.

Systems should be able to deal with it, although it seems that some Linux distributions had a problem with it.. If a system allows the leap second to be represented by hh:mm:60 then scripts and programming practices where the seconds range is defined as 0..59 can run into trouble...

Hi.

A few GNU/Linux seem to have produced a message about it:

Jun 30 18:59:59 (drl) kernel: [160267.112938] Clock: inserting leap second 23:59:60 UTC
Jun 30 18:59:59 vm-centos kernel: Clock: inserting leap second 23:59:60 UTC
(no messages from openSUSE 11.4)
(no messages from ubuntu 11.10)
(no messages from fedora 15)
(no messages from Solaris 10 10/08)
(no messages from FreeBSD, 8.0-RELEASE)
(no messages from Debian GNU/kFreeBSD 6.0)

cheers, drl

1 Like