Unverified Commit f1105409 authored by liuzhe-lz's avatar liuzhe-lz Committed by GitHub
Browse files

Merge pull request #2959 from microsoft/v1.9

Merge v1.9 back to master
parents 0a6c234a 88a225f8
......@@ -29,25 +29,53 @@ const convertTime = (num: number): string => {
}
};
const convertTimeToSecond = (str: string): number => {
let seconds = 0;
let d, h, m;
if (str.includes('d')) {
[d, str] = str.split('d');
seconds += parseInt(d) * 24 * 3600;
}
if (str.includes('h')) {
[h, str] = str.split('h');
seconds += parseInt(h) * 3600;
}
if (str.includes('m')) {
[m, str] = str.split('m');
seconds += parseInt(m) * 60;
}
if (str) {
seconds += parseInt(str.split('s')[0]);
}
return seconds;
};
// trial's duration, accurate to seconds for example 10min 30s
const convertDuration = (num: number): string => {
if (num < 1) {
return '0s';
const convertDuration = (seconds: number): string => {
let str = '';
const d = Math.floor(seconds / (24 * 3600));
if (d > 0) {
str += `${d}d `;
}
const hour = Math.floor(num / 3600);
const minute = Math.floor((num / 60) % 60);
const second = Math.floor(num % 60);
const result: string[] = [];
if (hour > 0) {
result.push(`${hour}h`);
seconds -= d * 24 * 3600;
const h = Math.floor(seconds / 3600);
if (h > 0) {
str += `${h}h `;
}
if (minute > 0) {
result.push(`${minute}min`);
seconds -= h * 3600;
const m = Math.floor(seconds / 60);
if (m > 0) {
str += `${m}m `;
}
if (second > 0) {
result.push(`${second}s`);
seconds -= m * 60;
if (seconds > 0) {
str += `${Math.floor(seconds)}s`;
}
return result.join(' ');
return str ? str : '0s';
};
function parseMetrics(metricData: string): any {
......@@ -246,6 +274,7 @@ function formatComplexTypeValue(value: any): string | number {
export {
convertTime,
convertDuration,
convertTimeToSecond,
getFinalResult,
getFinal,
downFile,
......
src/webui/src/static/img/logo.png

4.01 KB | W: | H:

src/webui/src/static/img/logo.png

2.32 KB | W: | H:

src/webui/src/static/img/logo.png
src/webui/src/static/img/logo.png
src/webui/src/static/img/logo.png
src/webui/src/static/img/logo.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment