Bug 64070

Summary: _timeshift function does not work with offset formatters
Product: JMeter Reporter: Markus Wolf <wolfm>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal Keywords: FixedInTrunk
Priority: P2    
Version: 5.2   
Target Milestone: JMETER_5.3.0   
Hardware: All   
OS: All   

Description Markus Wolf 2020-01-10 15:46:02 UTC
The _timeshift function does not work with a formatter of the form
"yyyy-MM-DD'T'HH:mm:ssXXX". This is due to the fact that internally a LocalDateTime is used instead of a ZonedDateTime.
An exception java.time.temporal.UnsupportedTemporalTypeException with text Unsupported field: OffsetSeconds
is thrown.

Can be easily tested with the function helper

${__timeShift(yyyy-MM-DD'T'dd:HH:mm:ss.SSSZ,,P2D,,)}

I think this could be very easily fixed and make a great tool even greater.
As a workaround I created a bean shell script working with ZonedDateTime.
Comment 1 Felix Schumacher 2020-01-10 17:18:08 UTC
Thanks for the report and the nice words about JMeter.

Could you test the next nightly, if the changes fix your problems?
If they do, you can close this bug.

commit 40db97b6dc1ca2460bf78d28d5368c83a4345869
AuthorDate: Fri Jan 10 18:12:47 2020 +0100

    _timeshift function does not work with offset formatters
    
    Bugzilla Id: 64070
---
 .../org/apache/jmeter/functions/TimeShift.java     | 40 ++++++++++++----------
 .../jmeter/functions/TestTimeShiftFunction.java    | 17 +++++++++
 xdocs/changes.xml                                  |  2 ++
 3 files changed, 41 insertions(+), 18 deletions(-)
Comment 2 Markus Wolf 2020-01-12 18:09:18 UTC
Tested the nightly build from 10.01.2020. It works now, thanks for the quick fix.