Bug 51527 - __time() function : add another option to __time() to provide *seconds* since epoch
Summary: __time() function : add another option to __time() to provide *seconds* since...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.4
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-19 06:47 UTC by Andrej van der Zee
Modified: 2012-09-28 14:02 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 4 The ASF infrastructure team 2022-09-24 20:37:46 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2509