Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__time() function : add another option to __time() to provide *seconds* since epoch #2509

Closed
asfimport opened this issue Jul 19, 2011 · 3 comments

Comments

@asfimport
Copy link
Collaborator

Andrej van der Zee (Bug 51527):
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.

OS: All

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
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.

@asfimport
Copy link
Collaborator Author

Andrej van der Zee (migrated from Bugzilla):
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!

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
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
#2509

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant