cancel
Showing results for 
Search instead for 
Did you mean: 

Need utilitiy to format milliseconds to a time format like hh:mm:ss to save in the Log

SOLVED
Occasional Contributor

Need utilitiy to format milliseconds to a time format like hh:mm:ss to save in the Log

In keyword testing (preferred), does TestComplete provide something that I can give a parameter of milliseconds like 7500 and it provides a pretty time, like 7:30.

 

I believe I've exhausted all available searching online, but I could be wrong. I actually hope I'm wrong about that.

 

I need this in order to log "quick to read" Counter values in the log doing Performance testing.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Need utilitiy to format milliseconds to a time format like hh:mm:ss to save in the Log

There is no built in utility that I know of to do what you're asking.  You will have to write some sort of custom code to convert a millisecond measurement to seconds.  

 

Technically speaking, 7500 converted to a "pretty" time is simply 7.5 seconds.  It's simply a matter of doing an arithmetic operation after converting your string to a number.  In JavaScript, it would look something like

 

function millisecondsToSeconds(time){
    return (aqConvert.VarToInt(time) / 1000);

}

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

1 REPLY 1
Community Hero

Re: Need utilitiy to format milliseconds to a time format like hh:mm:ss to save in the Log

There is no built in utility that I know of to do what you're asking.  You will have to write some sort of custom code to convert a millisecond measurement to seconds.  

 

Technically speaking, 7500 converted to a "pretty" time is simply 7.5 seconds.  It's simply a matter of doing an arithmetic operation after converting your string to a number.  In JavaScript, it would look something like

 

function millisecondsToSeconds(time){
    return (aqConvert.VarToInt(time) / 1000);

}

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available

View solution in original post

New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors