Time in 24 Hrs format

Hi

Can any one help me out in getting me the time in 24 hour clock format,

for example for 10:00:10 , 10 PM and 10 seconds should return 23:00:10,

Please let me know if there is any built in function which returns 24 hour clock time.

Thanks In Advance

There is a global property called the clockFormat that is used to specify whether you want times displayed in 12 or 24 hour format.

set the clockFormat to "24"

Most of the time formats have both 12 and 24 hour variants, as you can see by trying this:

set the clockFormat to "12 hour"
put the long time
put the common time
put the abbreviated local time

set the clockFormat to "24hr"
put the long time
put the common time
put the abbreviated local time

You can also contsruct your own time format using the formatted time function. Use “%I” for the hour in 12-hour format, %“H” for 24-hour format, and “%p” for AM/PM:

put formattedTime("%I:%M %p = %H:%M", "13:45")

Note: If you don’t specify a particular time (like “13:45” in the example), the formattedTime function formats the current date/time.

How can I get the time when one image appears, e.g after clicking Login button, it will turn to Loged page. Now I want to get the time when the image “Logout” appears, how?
Thanks!

The simplest way to do this is probably with a WaitFor command:

Click "Login"
put the time into LoginClickedTime
WaitFor 10,"Logout"
put the time into LogoutFoundTime
Log "Login took " & LogoutFoundTime - LoginClickedTime & " seconds"

That WaitFor command will begin looking for the Logout image and return as soon as it is found (or throw an exception if it doesn’t appear within 10 seconds).

The implementation of the WaitFor command searches the screen repeatedly, with a short delay (the ImageSearchDelay) between searches. So the timing reported by the code above may vary from the actual time by as much as the ImageSearchDelay (plus the amount of time it takes Eggplant to search the screen once). If it’s important for you to measure the time more precisely than that, you can set the ImageSearchDelay to a shorter time during this operation (its default value is 0.3 seconds).

Thanks, but can I get the time when an image disappears? I want to know how long the image exists during a transaction. Suppose there is no other images appears when the transaction is finished.

How to describe a image disappears? Can I get the time when it disappears and how?

If there is another image after the image disappeared, we can use

waitfor

function to get the time, but if there is no other images appears, can we use other approach to get the time? e g. when we click cancel button when installing an application, can we get the time the installing page disappears?

Thanks!

Sure. I would use the ImageFound() function to keep looking for the image until it isn’t found any more:

repeat while imageFound(0.1,"theImage")
    wait 0.1
end repeat

Or more simply:

wait while imageFound(0.1,"theImage")

The 0.1 tells Eggplant to stop looking for the image after one tenth of a second if it’s not found. Otherwise, when the image disappears, Eggplant will do its usual, thorough search for the image (taking more than 2 seconds with the default settings) before it gives up. I’m guessing you want more accurate timing than that.

For maximum timing accuracy, you can change the 0.1 to 0, and set the searchRectangle to a smaller area around the image. But using a value of 0 not only changes the timing but also eliminates a screen refresh that may be needed in some environments. The simple approach presented above is probably all that is needed for most situations.

Ok, thanks.

Hi, is there any function that can get remote system’s(system under test) info and memory, I want to write it to result file. Thanks!

SystemInfo() and SystemVersion() can only get local system info.

I’ve split your question off into a new topic. Generally, it’s helpful to start a new topic on the forum for each unrelated question, so people searching for answers have an easier time finding what they need.

You can read my reply to your question here.