@@ -15,7 +15,7 @@ function check_timing(type) {
15
15
} else if ( 'mark' == type ) {
16
16
value = performance . mark ( 'a' ) . startTime - performance . mark ( 'a' ) . startTime
17
17
} else if ( 'currenttime' == type ) {
18
- value = ( new DocumentTimeline ( ) . currentTime ) - ( new DocumentTimeline ( ) . currentTime )
18
+ value = ( gTimeline . currentTime ) - ( gTimeline . currentTime )
19
19
}
20
20
value = Math . trunc ( value )
21
21
// should match or the clock ticks over, e.g. 1ms or 16/17ms
@@ -43,38 +43,31 @@ function get_timing(METRIC) {
43
43
gData . timing [ 'mark' ] . push ( performance . mark ( 'a' ) . startTime )
44
44
} catch ( e ) { }
45
45
try { gData . timing [ 'date' ] . push ( ( new Date ( ) ) [ Symbol . toPrimitive ] ( 'number' ) ) } catch ( e ) { }
46
- try { gData . timing [ 'currenttime' ] . push ( new DocumentTimeline ( ) . currentTime ) } catch ( e ) { }
46
+ try { gData . timing [ 'currenttime' ] . push ( gTimeline . currentTime ) } catch ( e ) { }
47
47
48
48
/* testing
49
49
gData.timing.date = [1723240561321]
50
50
gData.timing.exslt = ['2024-08-09T20:23:10.000','2024-08-09T20:23:11.000']
51
+ gData.timing.currenttime = [4800.096,4833.43,4850.097,4866.764,4883.431,4900.098,4916.765,4933.432,4950.099,4966.766,4983.433]
51
52
//*/
52
53
53
54
let oGood = {
54
- 'date' : [ 0 , 1 , 16 , 17 , 33 , 34 , 50 , 66 , 67 , 83 , 84 ] ,
55
- // 1912129: exslt diffs must be 1000, and all end in .000
55
+ 'date' : [ 0 , 1 , 16 , 17 , 33 , 34 ] ,
56
56
'currenttime' : [
57
- // we're 2 decimal places, no drift
58
- 0 ,
59
- 16.66 , 16.67 ,
60
- 33.33 , 33.34 ,
61
- 50 ,
62
- 66.66 , 66.67 ,
63
- 83.33 , 83.34 ,
57
+ 0 , 0.01 , 0.02 ,
58
+ 16.66 , 16.67 , 16.68 ,
59
+ 33.33 , 33.34 , 33.35 ,
64
60
] ,
65
- 'exslt' : [ 0 ] ,
61
+ 'exslt' : [ 0 ] , // 1912129: exslt diffs must be 1000, and all end in .000
66
62
'other' : [
67
63
// tested 20/10mn timestamps over ~12s/6s = ~750/370 unique times
68
64
// the longer since the first time, the more decimal points drift
69
65
// so 0's become 0.1's then 0.2's etc: 6s seems to limit drift to 1 decimal point
70
- 0 , 0.1 , 0.2 ,
71
- 16.6 , 16.7 , 16.8 , //16.9,
72
- 33.3 , 33.4 , 33.5 ,
73
- 50 , 50.1 , 50.2 ,
74
- 66.6 , 66.7 , 66.8 , //66.9,
75
- 83.3 , 83.4 , 83.5
66
+ 0 , 0.1 , 0.2 , 0.3 ,
67
+ 16.6 , 16.7 , 16.8 , 16.9 ,
68
+ 33.3 , 33.4 , 33.5 , 33.36 ,
76
69
] ,
77
- 'ten' : [ 0 , 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 ] ,
70
+ 'ten' : [ 0 , 10 , 20 , 30 , 40 ] ,
78
71
}
79
72
80
73
let aNotInteger = [ 'mark' , 'now' , 'timestamp' ]
@@ -132,11 +125,12 @@ function get_timing(METRIC) {
132
125
let totaldiff = ( end - start )
133
126
totaldiff = ( 'currenttime' == k ? ( totaldiff . toFixed ( 2 ) ) : ( totaldiff . toString ( ) . match ( calc1 ) [ 0 ] ) ) * 1
134
127
aTotal . push ( totaldiff )
135
- let diff = ( totaldiff % 100 ) . toFixed ( 2 ) * 1 // drop hundreds
128
+ let diff = ( totaldiff % 50 ) . toFixed ( 2 ) * 1 // drop 50s
136
129
setDiffs . add ( diff )
137
130
}
138
131
let aDiffs = Array . from ( setDiffs )
139
132
//if ('currenttime' == k) {console.log(aDiffs)}
133
+
140
134
// test intervals
141
135
for ( let i = 0 ; i < aDiffs . length ; i ++ ) {
142
136
if ( isMatch && ! aGood . includes ( aDiffs [ i ] ) ) { isMatch = false }
@@ -176,9 +170,10 @@ function get_timing(METRIC) {
176
170
177
171
// display
178
172
str = aTotal . join ( ', ' )
179
- if ( str . length > 60 ) {
180
- let reduce = Math . floor ( ( str . length - 60 ) / 5 )
181
- let len = aTotal . length
173
+ let strLen = str . length
174
+ if ( strLen > 60 ) {
175
+ let len = aTotal . length , unitLen = strLen / ( aTotal . length )
176
+ let reduce = Math . floor ( ( str . length - 60 ) / unitLen )
182
177
let lasttwo = ' … ' + aTotal [ len - 2 ] + ', ' + aTotal [ len - 1 ]
183
178
let newTotal = aTotal . slice ( 0 , len - ( reduce + 2 ) )
184
179
if ( ( newTotal . join ( ', ' ) + lasttwo ) . length > 60 ) { newTotal = newTotal . slice ( 0 , len - ( reduce + 3 ) ) }
0 commit comments