GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Testing Tools  >  LoadRunner
Go To First  |  Previous Question  |  Next Question 
 LoadRunner  |  Question 6 of 197    Print  
Load Runner Function - How to get current system time

This function is developed to usein Mercury Load Runner peformance tool.

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);
}




  
Total Answers and Comments: 3 Last Update: June 03, 2008   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 16, 2006 00:29:29   #1  
pratheepa        

RE: Load Runner Function - How to get current system t...

hi,

just 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}"));


 
Is this answer useful? Yes | No
September 11, 2007 06:48:40   #2  
papayamilkshake Member Since: May 2007   Contribution: 31    

RE: Load Runner Function - How to get current system t...
You can utilise the parameter value for "Date/Time" where Vugen can extract the date for you depending on the format you want.  This is much simpler in writing codes.

-papayamilkshake 

 
Is this answer useful? Yes | No
June 03, 2008 07:13:25   #3  
soori.p Member Since: June 2008   Contribution: 3    

RE: Load Runner Function - How to get current system time

typedef long time_t;

Action()

{

     time_t t; 

lr_message("Time in seconds since 1/1/70: %ldn", time(&t));

     lr_message("Formatted time and date: %s", ctime(&t));

     return 0;

}


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape