VirtualBox

Changeset 86917 in vbox


Ignore:
Timestamp:
Nov 19, 2020 11:07:13 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141399
Message:

testmanager/common.js: Sync up to xtracker copy. Can skip seconds part now. bugref:9787

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/htdocs/js/common.js

    r84898 r86917  
    173173    }
    174174
    175     /* HH:MM:SS */
     175    /* HH:MM[:SS[.fraction] */
    176176    var iHour = parseInt(sTime.substring(0, 2), 10);
    177177    console.assert(sTime.charAt(2) == ':');
    178178    var iMin  = parseInt(sTime.substring(3, 5), 10);
    179     console.assert(sTime.charAt(5) == ':');
    180     var iSec  = parseInt(sTime.substring(6, 8), 10);
    181 
    182     /* Fraction? */
    183     var offTime = 8;
     179    var iSec          = 0;
    184180    var iMicroseconds = 0;
    185     if (offTime < sTime.length && '.,'.includes(sTime.charAt(offTime)))
    186     {
    187         offTime += 1;
    188         var cchFraction = 0;
    189         while (offTime + cchFraction < sTime.length && '0123456789'.includes(sTime.charAt(offTime + cchFraction)))
    190             cchFraction += 1;
    191         if (cchFraction > 0)
    192         {
    193             iMicroseconds = parseInt(sTime.substring(offTime, offTime + cchFraction), 10);
    194             offTime += cchFraction;
    195             while (cchFraction < 6)
     181    var offTime       = 5;
     182    if (sTime.charAt(5) == ':')
     183    {
     184        iSec  = parseInt(sTime.substring(6, 8), 10);
     185
     186        /* Fraction? */
     187        offTime = 8;
     188        if (offTime < sTime.length && '.,'.includes(sTime.charAt(offTime)))
     189        {
     190            offTime += 1;
     191            var cchFraction = 0;
     192            while (offTime + cchFraction < sTime.length && '0123456789'.includes(sTime.charAt(offTime + cchFraction)))
     193                cchFraction += 1;
     194            if (cchFraction > 0)
    196195            {
    197                 iMicroseconds *= 10;
    198                 cchFraction += 1;
    199             }
    200             while (cchFraction > 6)
    201             {
    202                 iMicroseconds = iMicroseconds / 10;
    203                 cchFraction -= 1;
     196                iMicroseconds = parseInt(sTime.substring(offTime, offTime + cchFraction), 10);
     197                offTime += cchFraction;
     198                while (cchFraction < 6)
     199                {
     200                    iMicroseconds *= 10;
     201                    cchFraction += 1;
     202                }
     203                while (cchFraction > 6)
     204                {
     205                    iMicroseconds = iMicroseconds / 10;
     206                    cchFraction -= 1;
     207                }
    204208            }
    205209        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette