|Summary:||__time() function : add another option to __time() to provide *seconds* since epoch|
|Product:||JMeter||Reporter:||Andrej van der Zee <andrejvanderzee>|
|Component:||Main||Assignee:||JMeter issues mailing list <issues>|
Description Andrej van der Zee 2011-07-19 06:47:52 UTC
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.
Comment 1 Sebb 2011-07-20 17:00:28 UTC
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.
Comment 2 Andrej van der Zee 2011-07-21 00:24:34 UTC
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!
Comment 3 Sebb 2012-09-28 14:02:10 UTC
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