Menu

#1953 23:59:61 with cdfTT2000 and xaxis length=15s

nextrelease
closed-fixed
nobody
None
5
2026-03-07
2018-02-06
No

Ivar found a strange bug where one of the ticks at a non-leap day boundary shows 23:59:61. To show this:

  1. plot https://emfisis.physics.uiowa.edu/Flight/RBSP-A/L2/2012/11/12/rbsp-a_magnetometer_uvw_emfisis-L2_20121112_v$(v,sep).cdf?Magnitude&timerange=2012-11-12
  2. zoom in to 15 seconds around 2012-11-11T00:00Z.
  3. reset the xaxis units to CDF_TT2000.
  4. pan and zoom around until "23:59:60" or "23:59:61" is used as a tick label, instead of "00:00:00"

This also has another interesting bug, where saving the state to a .vap doesn't load properly. In fact, when the bug is showing, the command line shows:

AP> print dom.plots[0].xaxis.range
2012-11-10 23:59:51.905 to 2012-11-12 00:00:10.978
AP> print dom.plots[0].xaxis.range.width()
19.07 s

Discussion

  • Jeremy Faden

    Jeremy Faden - 2018-02-06

    Here is a screenshot

     
  • Jeremy Faden

    Jeremy Faden - 2018-02-07

    Here is a script that demos the bug:

    u= Units.cdfTT2000
    d= u.parse('2012-01-10T24:00')
    print d, d.doubleValue(u)
    
    d= u.createDatum( 3.79512066183999E17 )
    print d, d.doubleValue(u)
    
    d= u.createDatum( 3.7951206618399987E17 )
    print d, d.doubleValue(u)
    
     
  • Jeremy Faden

    Jeremy Faden - 2018-02-07

    In TimeUtil.toTimeStruct, there's odd code for CDF_TT2000:

    if ( u==Units.cdfTT2000 && sinceMidnight<0.0 ) { //TODO: huh?  this needs review
                mjd1958= mjd1958-1;
                sinceMidnight= sinceMidnight+86401e9;
    }
    

    I think it's time to review it.

    There are actually two bugs here. When it shows "2012-01-10T23:59:60.000Z" this is because of a rounding error, where it's not smart enough to roll over the seconds and minutes. When it shows "61" it's because it's entering the strange branch.

     

    Last edit: Jeremy Faden 2018-02-07
  • Jeremy Faden

    Jeremy Faden - 2018-02-07

    The leap seconds part of this bug is fixed, by verifying that this could actually be a leap day.

     
  • Jeremy Faden

    Jeremy Faden - 2018-02-07

    I believe the 23:58:60 is fixed as well. It too was a cdfTT2000 problem, where it didn't properly move 60s to 1min because it could be a leap second. I made it so that the leap second would have to be on June/30 or Dec/31, which is more precise, though will fail twice a year.

     
  • Jeremy Faden

    Jeremy Faden - 2018-02-12

    Masafumi pointed out that this fix causes a new problem. This code demos:

    # demo Masafumi's bug.
    t1= Units.us2000.createDatum(5.7131324787700E14)
    t2= Units.us2000.createDatum(5.7131324799988E14)
    timeRange= DatumRange(t1,t2)
    print timeRange
    print timeRange.width()
    
    print timeRange.min().toString()
    print timeRange.max().toString()
    
     
  • Jeremy Faden

    Jeremy Faden - 2019-03-26

    There's a special branch now for Datums backed by longs, so that CDF_TT2000 can be precisely represented. See https://sourceforge.net/p/autoplot/bugs/2133/

     
  • Jeremy Faden

    Jeremy Faden - 2019-03-26

    I can't see the bug Ivar originally described (I guess that means I fixed it), but I do see where the midnight location is not used for the tag, with noise from roundoff. See image.

     
  • Jeremy Faden

    Jeremy Faden - 2026-03-07

    This seems to be fixed.

     
  • Jeremy Faden

    Jeremy Faden - 2026-03-07
    • status: open --> closed-fixed
     
MongoDB Logo MongoDB