Skip to content

Conversation

@jameskerr
Copy link
Contributor

@jameskerr jameskerr commented Jul 1, 2024

Fixes #3101

With this fix:

If the duration is less than 1 second, it will display "xxxmilliseconds"
If it is less than 1 millisecond, it will display "less than one millisecond"

CleanShot 2024-07-01 at 11 34 24@2x

if (this.r.get("_path").toString() !== "conn") return null
const dur = this.r.get<zed.Duration>("duration").asSeconds()
if (!dur) return
const dur = this.r.get<zed.Duration>("duration").asMs()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use milliseconds here instead of seconds, to get the most precision we can.

}
if (allZero) {
parts.push(formatPart((end.getTime() - start.getTime()) / 1000, "seconds"))
if (end.getTime() === start.getTime()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if the two dates are the same to determine if the duration is less than 1ms.

@jameskerr jameskerr requested a review from philrz July 1, 2024 18:37
Copy link
Contributor

@philrz philrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix seems effective. I saw one of the tests was broken so I pushed a commit to fix it.

@jameskerr
Copy link
Contributor Author

Thanks Phil!

@jameskerr jameskerr merged commit 804fe3f into main Jul 2, 2024
@jameskerr jameskerr deleted the tiny-duration branch July 2, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tiny duration shown as "Not available" in correlations view

3 participants