In my test scenario I need get the current Epoch timestamp in an HTTP request parameter. I had to write a custom function, but maybe it would be a better idea to expand the __time() function to include epoch time in seconds and/or milliseconds since 1970/1/1 00:00:00.
The __time() function already provides the current time in milliseconds - just omit the format parameter, and it returns the output from System.currentTimeMillis(). Is that what you meant? It might still be useful to add support for returning the time in seconds as well.
Uhhh yes you are right. I guess I did not read the documentation well enough, it already provides a millisecond representation. I usually scan-read documentation and the millisec-option is not provided in the format-list, but instead mentioned separately. I guess that is why I missed it. In my test case, I do need an Epoch in seconds, as you mentioned. To this end, it would be useful to add another option to __time() to provide *seconds* since 1970/00/00 00:00:00, as you mentioned. In my test plan, I need to send the current time in seconds for many HTTP request. Starting the Java interpreter in order to convert millisec to second is just a waist of CPU cycles. I hope you can add it!
URL: http://svn.apache.org/viewvc?rev=1391471&view=rev Log: __time() function : add another option to __time() to provide *seconds* since epoch Added /dddd division option Bugzilla Id: 51527 Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/TimeFunction.java jmeter/trunk/test/src/org/apache/jmeter/functions/TestTimeFunction.java jmeter/trunk/xdocs/changes.xml jmeter/trunk/xdocs/usermanual/functions.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2509