I am looking for the equivalent of Java's System.currentTimeMillis() in Loadrunner. I could only find lr_save_datetime("%x%X", 0, "now"); which outputs in date and time format but not the time since epoch.
In C, time.h can provide this but #include "time.h" in the LR script resulted in compilation errors. time.h probably has dependencies on other .h and .inl files.
I got #error ERROR: Only Win32 target supported! even though I had copied all the files it complained were missing, from the Visual studio C++ compilers folder. (C:\Program Files\Microsoft Visual Studio 9.0\VC\include\time.h)
Another approach is to use lr_save_timestamp to get the timestamp in seconds – it is more powerful than web_save_timestamp_param.
My documentation for the function:
int lr_save_timestamp( const char* tmstampParam, [DIGITS,] LAST );
tmstampParam
The name of the parameter to store the timestamp.
DIGITS
Optional. The number of digits for the timestamp (integer). The default is 13 (epoch time including 3 digits of millisecond precision).
If the value of DIGITS is less than 1 or more than 16, the default is used
In this example, the timestamp is saved and a length of 10 digits is specified. Returns the epoch time in seconds
lr_save_timestamp(“param”, “DIGITS=10″, LAST );