This main use of this functions to return the current system time at any given
point of time while load runner script is running.This functiona can be used to
report transaction times , script starti time and end time.
long get_secs_since_midnight(void)
{
char * curr_hr; /* pointer to a parameter with current clock hr */
char * curr_min; /* pointer to a parameter with current clock min*/
char * curr_sec; /* pointer to a parameter with current clock sec */
long current_time, /* current number of seconds since midnight */
hr_secs, /* current hour converted to secs */
min_secs, /* current minutes converted to secs */
secs_secs; /* current number of seconds*/
curr_hr = lr_eval_string("{current_hr}>");
curr_min = lr_eval_string("{current_min}");
curr_sec = lr_eval_string("{current_sec}");
hr_secs = (atoi(curr_hr)) * 60 * 60;
min_secs = (atoi(curr_min)) * 60;
secs_secs = atoi(curr_sec);
current_time = hr_secs + min_secs + secs_secs;
return(current_time);
}
Then these two lines are enough for getting current time.
lr_save_datetime("Today is %H %M %S", DATE_NOW, "curr_time");
lr_output_message(lr_eval_string("{curr_time}"));
point of time while load runner script is running.This functiona can be used to
report transaction times , script starti time and end time.
long get_secs_since_midnight(void)
{
char * curr_hr; /* pointer to a parameter with current clock hr */
char * curr_min; /* pointer to a parameter with current clock min*/
char * curr_sec; /* pointer to a parameter with current clock sec */
long current_time, /* current number of seconds since midnight */
hr_secs, /* current hour converted to secs */
min_secs, /* current minutes converted to secs */
secs_secs; /* current number of seconds*/
curr_hr = lr_eval_string("{current_hr}>");
curr_min = lr_eval_string("{current_min}");
curr_sec = lr_eval_string("{current_sec}");
hr_secs = (atoi(curr_hr)) * 60 * 60;
min_secs = (atoi(curr_min)) * 60;
secs_secs = atoi(curr_sec);
current_time = hr_secs + min_secs + secs_secs;
return(current_time);
}
Then these two lines are enough for getting current time.
lr_save_datetime("Today is %H %M %S", DATE_NOW, "curr_time");
lr_output_message(lr_eval_string("{curr_time}"));
No comments:
Post a Comment