Skip to content

Commit 6fff6d8

Browse files
authored
Resolved issue of wrong log time computing (#765)
resolved issue of getTimes flightLog methods in case of call with log index argument
1 parent bb7b021 commit 6fff6d8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/flightlog.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,23 @@ export function FlightLog(logData) {
117117
* Get the earliest time seen in the log of the given index (in microseconds), or leave off the logIndex
118118
* argument to fetch details for the current log.
119119
*/
120-
this.getMinTime = function () {
121-
return logIndexes.getIntraframeDirectory(logIndex).minTime;
120+
this.getMinTime = function (index) {
121+
index = index ?? logIndex;
122+
return logIndexes.getIntraframeDirectory(index).minTime;
122123
};
123124

124125
/**
125126
* Get the latest time seen in the log of the given index (in microseconds), or leave off the logIndex
126127
* argument to fetch details for the current log.
127128
*/
128-
this.getMaxTime = function () {
129-
return logIndexes.getIntraframeDirectory(logIndex).maxTime;
129+
this.getMaxTime = function (index) {
130+
index = index ?? logIndex;
131+
return logIndexes.getIntraframeDirectory(index).maxTime;
130132
};
131133

132-
this.getActualLoggedTime = function () {
133-
const directory = logIndexes.getIntraframeDirectory(logIndex);
134+
this.getActualLoggedTime = function (index) {
135+
index = index ?? logIndex;
136+
const directory = logIndexes.getIntraframeDirectory(index);
134137
return directory.maxTime - directory.minTime - directory.unLoggedTime;
135138
};
136139

0 commit comments

Comments
 (0)