You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2022/08/24 09:10:48 UTC

[groovy] branch GROOVY_4_0_X updated: minor tweaks

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push:
     new e20214b39d minor tweaks
e20214b39d is described below

commit e20214b39dfc903a4001310e1e862b00494e26e8
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Aug 24 19:10:39 2022 +1000

    minor tweaks
---
 subprojects/performance/src/files/pleac03.groovy | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/subprojects/performance/src/files/pleac03.groovy b/subprojects/performance/src/files/pleac03.groovy
index e5a59854c9..f6ee3cb030 100644
--- a/subprojects/performance/src/files/pleac03.groovy
+++ b/subprojects/performance/src/files/pleac03.groovy
@@ -37,6 +37,12 @@ println 'Today is day ' + cal.get(Calendar.DAY_OF_YEAR) + ' of the current year.
 //     http://joda-time.sourceforge.net/
 // there is a special Grails (grails.org) time DSL (see below)
 //----------------------------------------------------------------------------------
+import static java.util.Calendar.*
+import java.time.*
+println "Today is day ${cal[DAY_OF_YEAR]} of the current year."
+println LocalDateTime.now()
+// => 2022-08-24T17:59:41.359654800
+println "Today is day ${LocalDateTime.now().dayOfYear} of the current year."
 
 // @@PLEAC@@_3.1
 //----------------------------------------------------------------------------------
@@ -47,6 +53,9 @@ D = cal.get(Calendar.DATE)
 println "The current date is $Y $M $D"
 // => The current date is 2006 04 28
 //----------------------------------------------------------------------------------
+(_E, Y, M, _WY, _WM, D) = Calendar.instance
+println "The current date is $Y $M $D"
+// => The current date is 2022 07 24
 
 // @@PLEAC@@_3.2
 //----------------------------------------------------------------------------------
@@ -200,7 +209,7 @@ input = new BufferedReader(new InputStreamReader(System.in)).readLine()
 after = System.currentTimeMillis()
 elapsed = (after - before) / 1000
 println "You took $elapsed seconds."
-// => You took2.313 seconds.
+// => You took 2.313 seconds.
 
 // take mean sorting time
 size = 500; number = 100; total = 0