Leap seconds

I'd be interested to know if any developers are affected by the recently issued "leap second" in their software. These may become an issue if you record high-resolution time-based data for long periods of time (which happens to be our business).

If neither discarding the extra second nor having a duplicate time stamp in the database is acceptable, how do you handle this?
0
Arthur
7/2/2015 8:35:50 AM
embarcadero.delphi.non-tech 5933 articles. 1 followers. Follow

9 Replies
573 Views

Similar Articles

[PageSpeed] 14

Arthur Hoornweg wrote:

> I'd be interested to know if any developers are affected by the
> recently issued "leap second" in their software. These may become an
> issue if you record high-resolution time-based data for long periods
> of time (which happens to be our business).
> 
> If neither discarding the extra second nor having a duplicate time
> stamp in the database is acceptable, how do you handle this?

Why a duplicate time stamp? Why not just a single, correct time stamp?

-- 
Rudy Velthuis        http://www.rvelthuis.de

"There's a fine line between being on the leading edge and being
 in the lunatic fringe." -- Frank Armstrong
0
Rudy
7/2/2015 9:25:33 AM
Rudy Velthuis (TeamB) <newsgroups@rvelthuis.de> wrote in news:727626
@forums.embarcadero.com:

> 
> Why a duplicate time stamp? Why not just a single, correct time stamp?
> 

Becasue the leap second means that at some point the same second occurs 
twice.

That means a small change that the same timestamp will occur.

Unless you user the frowned upon Google method of handling leap seconds of 
course.
0
Christopher
7/2/2015 9:41:44 AM
Christopher Burke wrote:

> Rudy Velthuis (TeamB) <newsgroups@rvelthuis.de> wrote in news:727626
> @forums.embarcadero.com:
> 
> > 
> > Why a duplicate time stamp? Why not just a single, correct time
> > stamp?
> > 
> 
> Becasue the leap second means that at some point the same second
> occurs twice.

Not really, although setting the clock back one second is one way of
dealing with it.
-- 
Rudy Velthuis        http://www.rvelthuis.de

"I would have made a good Pope."
 -- Richard M. Nixon (1913-1994)
0
Rudy
7/2/2015 1:53:39 PM
Am 02.07.2015 um 15:53 schrieb Rudy Velthuis (TeamB):
> Christopher Burke wrote:
> 
>> Rudy Velthuis (TeamB) <newsgroups@rvelthuis.de> wrote in news:727626
>> @forums.embarcadero.com:
>>
>>>
>>> Why a duplicate time stamp? Why not just a single, correct time
>>> stamp?
>>>
>>
>> Becasue the leap second means that at some point the same second
>> occurs twice.
> 
> Not really, although setting the clock back one second is one way of
> dealing with it.
> 

Hello,

I fear you haven't yet understood completely: if you record some data
every second and store that in a DB with the requirement that the
timestamp is unique you're introuble by just readjusting the clock for
that second, as this will prduce the same timestamp again.

Greetings

Markus
0
Markus
7/2/2015 7:02:01 PM
Markus Humm wrote:

> if you record some data
> every second and store that in a DB with the requirement that the
> timestamp is unique you're introuble by just readjusting the clock for
> that second, as this will prduce the same timestamp again.

Yes, this is problem.

AFAIK OSs have special mechanism to avoid time jumps: the system is
slightly lengthen/shorten the timer tick until the system time will not
be accurate; there is no time jump in this case.

But I do not know how to system handles the massive jump time jump
(like second in question). Probably system does the same but the system
time becomes inaccurate on some relatively long interval.

--
Alex
0
Alex
7/3/2015 4:37:12 AM
Markus Humm wrote:

> Am 02.07.2015 um 15:53 schrieb Rudy Velthuis (TeamB):
> > Christopher Burke wrote:
> > 
> >> Rudy Velthuis (TeamB) <newsgroups@rvelthuis.de> wrote in
> news:727626 >> @forums.embarcadero.com:
> > > 
> > > > 
> >>> Why a duplicate time stamp? Why not just a single, correct time
> >>> stamp?
> > > > 
> > > 
> >> Becasue the leap second means that at some point the same second
> >> occurs twice.
> > 
> > Not really, although setting the clock back one second is one way of
> > dealing with it.
> > 
> 
> Hello,
> 
> I fear you haven't yet understood completely: if you record some data
> every second and store that in a DB with the requirement that the
> timestamp is unique you're introuble by just readjusting the clock for
> that second, as this will prduce the same timestamp again.

I have understood that. One way of dealing with this is a unique
timestamp for that one leap second. Of course, if that is possible
depends on who writes which part of the software.


-- 
Rudy Velthuis        http://www.rvelthuis.de

Carlson's Consolation: Nothing is ever a complete failure; it can
always serve as a bad example.
0
Rudy
7/3/2015 6:26:19 AM
> AFAIK OSs have special mechanism to avoid time jumps: the system is
> slightly lengthen/shorten the timer tick until the system time will not
> be accurate; there is no time jump in this case.

No. That's the solution that Amazon and Google implemented in their own services to "fool" OS/applications that can't handle a leap second properly, but it's not a general one. The NTP protocol does actually send a "leap second" flag, but tthen it's up to the system how to handle it.

Actually, Windows doesn't handle leap seconds truly:

https://support.microsoft.com/en-us/kb/909614

Thereby you can risk the clock being turned back one second the next time Windows Time Service syncs the time.

Linux uses a 61 second minute (but beware some older kernels have a bug), it will add a second (this is from a machine of mine that was in CEST time zone):

Jul  1 01:59:59 ntdb kernel: [662118.555111] Clock: inserting leap second 23:59:60 UTC

Thereby applications need be ready to accept a 61 second minute, and a 86401 seconds day - is the Delphi RTL designed to accept leap seconds? I never checked.

If using a database (or whatever else handling dates), you need to check how it deals with leap seconds. If you believed UTC was a solution to have unique timestamps and 86400 days always, well, you didn't understand UTC fully :-)
0
Luigi
7/3/2015 10:06:57 AM
Luigi Sandon wrote:

> If you believed UTC was a solution to have unique timestamps and 86400
> days always, well, you didn't understand UTC fully :-)

Thank you for information.

Thank God, I have no deal with precise time in my practice. :-)

--
Alex
0
Alex
7/4/2015 12:39:37 PM
Markus Humm wrote:

> Am 02.07.2015 um 15:53 schrieb Rudy Velthuis (TeamB):
> > Christopher Burke wrote:
> > 
> >> Rudy Velthuis (TeamB) <newsgroups@rvelthuis.de> wrote in
> news:727626 >> @forums.embarcadero.com:
> > > 
> > > > 
> >>> Why a duplicate time stamp? Why not just a single, correct time
> >>> stamp?
> > > > 
> > > 
> >> Becasue the leap second means that at some point the same second
> >> occurs twice.
> > 
> > Not really, although setting the clock back one second is one way of
> > dealing with it.
> > 
> 
> Hello,
> 
> I fear you haven't yet understood completely:

I think I understood much better than you fear.

> if you record some data
> every second and store that in a DB with the requirement that the
> timestamp is unique you're introuble by just readjusting the clock for
> that second, as this will prduce the same timestamp again.

Not necessarily. Make the timestamp unique.



-- 
Rudy Velthuis        http://www.rvelthuis.de

Weinberg's Corollary: An expert is a person who avoids the small
errors while sweeping on to the grand fallacy.
0
Rudy
7/5/2015 4:34:37 PM
Reply:

Similar Artilces:

here's a tech question for non-tech
I have not had occasion to want to do this before, so I'm hoping someone can enlighten me. I have an app built in D7, and it's rather complex in its functionality. Is it possible to rebuild the app to run as a service? Would that require separating the user interface from the app? Thanks, Bill William Meyer wrote on 4/22/2010 : > I have not had occasion to want to do this before, so I'm hoping > someone can enlighten me. I have an app built in D7, and it's rather > complex in its functionality. Is it possible to rebuild the app to run > as a service?...

Leap seconds #3
I started the leap seconds implementation. There is a new DateTime test: t/19leap_second.t Currently, only add_duration is implemented. All other tests are unmodified, and it is quite likely that nothing will break (please let me know). - Flavio S. Glock ...

Leap Seconds and Epochs
Why does time() return a multiple of 60? Surely each time there's a leap second time()%60 should increment? Cheers! Rick Measham Cause time since the epoch doesn't measure leap seconds. See in the DateTime manual, under the epoch() method description. On 11/20/05, Rick Measham <rickm@isite.net.au> wrote: > Why does time() return a multiple of 60? Surely each time there's a leap > second time()%60 should increment? > > Cheers! > Rick Measham > > mathieu longtin wrote: > Cause time since the epoch doesn't measure leap seconds....

How to handle leap seconds?
That is the question at hand. I have some code I've written that will tell me how many leap seconds off a given UTC time is from TAI, but what do I do with that? For example, the current code assumes that all days are 86,400 seconds, when normalizing a "rd days, rd secs" pair of values. This doesn't quite work since in some cases we do want to allow the rd secs to be 86,401 (which corresponds to a clock time of 23:59:60). Gah! What a PITA. Or is there some simple way to handle leap sceonds that I'm missing? I've found lots of references on the web tel...

More leap second fun
Ok, what the heck should this do: my $dt = DateTime->new( year => 1971, month => 12, day => 31, hour => 23, minute => 59, second => 60, time_zone => 'UTC', ); print $dt->datetime; # this will display the datetime as 1971-12-31T23:59:60, # which is correct $dt->add( days => 1 ); # prints what? print $dt->datetime; $dt->subtract( days => 1 ); # prints what? print $dt->datetime; So what do those print statements print? Right now the...

leap seconds in XS
I just checked this in, but I'm not sure if it's much faster. It'd be good if someone who knows more about about C could look at the implementation and see if there's anything they can think of to improve it. Also, I should probably change the generated code to use the binary search method that Flavio's DateTime::LeapSecond generated code uses. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ On Wed, 6 Aug 2003, Dave Rolsky wrote: > I just checked this in, but I'm not sure if it's much...

leap seconds #2
May I import Date::Leapsecond into "modules/DateTime.pm/lib/DateTime/Leapsecond.pm"? I could then make the changes in DateTime to use it. - Flavio S. Glock On Sat, 12 Apr 2003 fglock@pucrs.br wrote: > May I import Date::Leapsecond into > "modules/DateTime.pm/lib/DateTime/Leapsecond.pm"? > > I could then make the changes in DateTime to use it. How will it be used? I've been trying to think of a good way to handle leapseconds in DateTime.pm for a while and I still haven't come up with anything that I'm happy with. -dave ...

Ah, leap seconds
http://serverfault.com/questions/403732/anyone-else-experiencing-high-rates-of-linux-server-crashes-today -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/ Dave Rolsky wrote: > http://serverfault.com/questions/403732/anyone-else-experiencing-high-rates-of-linux-server-crashes-today Thank you very much for this timely word of warning, Dave. Barely 20 minutes after you po...

Testing Non-Tech
I haven't seen anything for three days in this group! -- Q 01/24/2014 15:15:19 1.19.1.372 [Q'sBrokenToolBar] [Running on TQ] Quentin Correll wrote: > I haven't seen anything for three days in this group! How can that be? You replied to a post from Nick in thread "Test the best" today. -- Arno Arno, | How can that be? You replied to a post from Nick in thread | "Test the best" today. Strangely enough, I could post. <g> But I wasn't sure about that since XN didn't "receive" anything until I did ...

Second Hand delphi
Hi Where is the best place for me to buy a second hand version of Delphi. thank you M.P. Skinner > Where is the best place for me to buy a second hand version of Delphi. My understanding is that recent versions of Delphi have a non-transferable license. So I should check this first, as you may find that your 'second-hand' version has no legal status. There are free cut-down 'explorer' versions available but of older product versions. ebay lists some older versions. Again I should check this out, but I,m pretty sure that my copy of Delphi 5 permitted (a &#...

DateTime and double leap seconds
The DateTime synopsis says $second =3D $dt->second; # 0-60 (leap seconds!) but The Single UNIX =AE Specification, Version 2, says int tm_sec seconds [0,61] to allow double leap seconds. See http://www.opengroup.org/onlinepubs/007908799/xsh/time.h.html The authoritative reference is probably ISO 31-1, but I don't have a copy of it. Perhaps the DateTime object ought to allow seconds in [0,61] too? Peter -- Peter J. Acklam - pjacklam@online.no - http://home.online.no/~pjacklam On Thu, 20 Feb 2003, Peter J. Acklam wrote: > The...

ANNOUNCE: DateTime leap seconds
Dave Rolsky wrote: > Ok, if you're sure you can get this working, why don't you go ahead and > implement it. done! - Flavio S. Glock On Mon, 14 Apr 2003, Flavio S. Glock wrote: > Dave Rolsky wrote: > > Ok, if you're sure you can get this working, why don't you go ahead and > > implement it. > > done! Not quite ;) I've found some bugs, but I'm trying to figure out how to fix them. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ ...

Delphi market non-existent?
It appears the development contracting market for Delphi has dried up. Is anyone finding contracts? Not employment, contract work. > {quote:title=Rich _ wrote:}{quote} > It appears the development contracting market for Delphi has dried up. Where? > Is anyone finding contracts? Not employment, contract work. Yes -- Regards Bruce McGee Glooscap Software > {quote:title=Bruce McGee wrote:}{quote} > > Where? The US. > > Yes BTW, are you keeping more than 2 people employed full-time? > {quote:title=Rich _ wrote:}{quote} > The US....

Web resources about - Leap seconds - embarcadero.delphi.non-tech

Second Gear
Second Gear creates beautiful iPhone and iPad applications, including Elements for storing your writing and notes on Dropbox.

Second Intermediate Period of Egypt - Wikipedia, the free encyclopedia
Apparently, she had no heirs, causing the twelfth dynasty to come to a sudden end as did the Golden Age of the Middle Kingdom, which was succeeded ...

Second woman missing from Sakya International Buddhist retreat found in Buchan bushland
A woman has gone missing from a Victorian Buddhist retreat just one week after another guest was lost in the bush for five days.

High-Class Audio Mastering Within Seconds?
... , an instant audio mastering platform, launches a new cloud-based service that delivers affordable and high-class audio mastering within seconds. ...

Bruce Arians on second-down play call: ‘I did call a run’
Arizona Cardinals head coach Bruce Arians clarified a play call that left many perplexed during a 26-20 overtime win over the Packers Saturday ...

Build conference sells out in seconds, even with higher price and no hardware giveaway
San Francisco has a famous bridge that was designed to look like the Cisco logo. (credit: Microsoft) Microsoft's Build developer conference ...

"What is it with the giggling about Trump saying 'Two Corinthians' instead of 'Second Corinthians'? Either ...
... Feels like the beginning of a joke.... Two Corinthians walk into a bar. The first Corinthian says "Boy, do I need some spirit." And the second ...

Jamie Foxx rescued a man from a burning vehicle five seconds before it went up
... belt and pulled Kyle out to safety. “I grabbed the scissors from him, cut the seatbelt,” Foxx said. “As we pulled him out, within five seconds ...

All-Climate EV Battery Range Extender Goes From -22 to 32F In 30 Seconds
... State researchers have come up with an effective, affordable solution All-Climate EV Battery Range Extender Goes From -22 to 32F In 30 Seconds ...

Trump First, Kasich Second In New Hampshire
Trump First, Kasich Second In New Hampshire

Resources last updated: 1/21/2016 5:47:03 PM