You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by GitBox <gi...@apache.org> on 2021/09/20 17:07:34 UTC

[GitHub] [jmeter] mawasak commented on a change in pull request #672: timeShift function docs update.

mawasak commented on a change in pull request #672:
URL: https://github.com/apache/jmeter/pull/672#discussion_r712357389



##########
File path: xdocs/usermanual/functions.xml
##########
@@ -1575,13 +1575,14 @@ returns:
     </description>
 <properties>
         <property name="Format" required="No">
-        The format to be passed to DateTimeFormatter.
+        The format to be passed to DateTimeFormatter (for input data parsing and output formating).
         See <a href="https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html">DateTimeFormatter</a>
-        If omitted, the function uses milliseconds since epoch format.
+        If omitted, the function returns milliseconds.

Review comment:
       Yes, You are right. I mean that when format is not given and date to shift is given (and must be Long) the code is reduced to result that don't  seem explicitly connect with epoch:
   
   `Duration duration = Duration.parse("PT10S");`
   `ZoneId systemDefaultZoneID = ZoneId.systemDefault();`
   `ZonedDateTime  zonedDateTimeToShift = ZonedDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong("10000")), systemDefaultZoneID);`
   `zonedDateTimeToShift = zonedDateTimeToShift.plus(duration);`
   `String result = String.valueOf(zonedDateTimeToShift.toInstant().toEpochMilli());`
   `System.out.println(result); //just 20000ms`
   
   
   But, yes, when date to shift is not given  (is default: now) then connection with epoch is seen better:
   
   `Duration duration = Duration.parse("PT10S");`
   `ZoneId systemDefaultZoneID = ZoneId.systemDefault();`
   `ZonedDateTime zonedDateTimeToShift = ZonedDateTime.now(systemDefaultZoneID);`
   `zonedDateTimeToShift = zonedDateTimeToShift.plus(duration);`
   `String result = String.valueOf(zonedDateTimeToShift.toInstant().toEpochMilli());`
   `System.out.println(result); //1632157138893ms`




-- 
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