You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by "vlsi (via GitHub)" <gi...@apache.org> on 2023/03/26 11:30:01 UTC

[GitHub] [jmeter] vlsi commented on a diff in pull request #5796: Warn about time format change only once

vlsi commented on code in PR #5796:
URL: https://github.com/apache/jmeter/pull/5796#discussion_r1148534522


##########
src/functions/src/main/java/org/apache/jmeter/functions/TimeFunction.java:
##########
@@ -96,13 +99,17 @@ public String execute(SampleResult previousResult, Sampler currentSampler) throw
                 long div = Long.parseLong(fmt.substring(1)); // should never case NFE
                 datetime = Long.toString(System.currentTimeMillis() / div);
             } else {
-                if (fmt.contains("u")) {
+                DateTimeFormatter df = DateTimeFormatter // Not synchronised, so can't be shared
+                        .ofPattern(fmt);

Review Comment:
   Is it really non-thread-safe?
   
   The javadoc says otherwise: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
   
   > A formatter created from a pattern can be used as many times as necessary, it is immutable and is thread-safe.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org