MCPcopy Create free account
hub / github.com/Borvik/vscode-postgres / getDurationText

Method getDurationText

src/common/database.ts:99–125  ·  view source on GitHub ↗
(milliseconds: number)

Source from the content-addressed store, hash-verified

97 }
98
99 private static getDurationText(milliseconds: number): string {
100 let sec = milliseconds / 1000.0;
101 // More than 60 sec -> 2 min 5 sec
102 if (sec > 60) {
103 let min = Math.floor(sec / 60);
104 sec = Math.round(sec - min * 60);
105 return String(min) + ' min ' + String(Math.round(sec)) + 'sec';
106 }
107 // More than 10 sec -> 33 sec.
108 if (sec >= 20) {
109 sec = Math.round(sec);
110 return String(sec) + ' sec';
111 }
112 // More than 2 sec -> 3.3 sec.
113 else if (sec > 2) {
114 sec = Math.round(sec * 10) / 10;
115 return String(sec) + ' sec';
116 }
117 // More than 0.1 sec -> 0.33 sec.
118 else if (sec > 0.1) {
119 sec = Math.round(sec * 100) / 100;
120 return String(sec) + ' sec';
121 }
122 // Full precision
123 sec = Math.round(sec * 1000) / 1000;
124 return String(sec) + ' sec';
125 }
126
127 public static async runQuery(sql: string, editor: vscode.TextEditor, connectionOptions: IConnection, showInCurrentPanel: boolean = false) {
128 // let uri = editor.document.uri.toString();

Callers 1

runQueryMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected