Removed direct references to Timestamp and DateAndTime classes
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 30 Sep 2015 09:18:22 +0100
changeset 290 4edd481e1725
parent 289 256720089f87
child 291 f220584b87a0
Removed direct references to Timestamp and DateAndTime classes Use `Smalltalk at:` to access them. On Pharo, this avoids a warning about undeclared variable (although the code would never fall into that branch). On Smalltalk/X, this removes a dependency on stx:libcompat.
s/BenchmarkResultC.st
s/Make.proto
s/bc.mak
s/jv_calipel_s.st
--- a/s/BenchmarkResultC.st	Wed Sep 30 09:03:50 2015 +0100
+++ b/s/BenchmarkResultC.st	Wed Sep 30 09:18:22 2015 +0100
@@ -73,9 +73,11 @@
 !
 
 timestamp
+    self initializeTimestampIfNotAlready.
     ^ timestamp
 
     "Created: / 23-06-2013 / 00:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-09-2015 / 09:04:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !BenchmarkResultC methodsFor:'adding & removing'!
@@ -99,17 +101,22 @@
 
 initializeTimestamp
 
-    Smalltalk isSmalltalkX ifTrue:[
-        timestamp := Timestamp now.
+    BenchmarkPlatform current isSmalltalkX ifTrue:[
+        "Use Smalltalk at: to avoid reference to undeclared
+         global in Pharo (so Monticello won't complain)"
+        timestamp := (Smalltalk at:#Timestamp) now.
         ^self
     ].
-    Smalltalk isSqueak ifTrue:[
-        timestamp := DateAndTime now.
+    BenchmarkPlatform current isPharo ifTrue:[
+        "Use Smalltalk globals at: to avoid reference to undeclared
+         global in Smalltalk/X (so stc won't complain)"
+        timestamp := (Smalltalk globals at: #DateAndTime) now.
         ^self
     ].
     self error: 'Unsupported platform'
 
     "Created: / 23-06-2013 / 00:39:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-09-2015 / 09:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 initializeTimestampIfNotAlready
--- a/s/Make.proto	Wed Sep 30 09:03:50 2015 +0100
+++ b/s/Make.proto	Wed Sep 30 09:18:22 2015 +0100
@@ -34,7 +34,7 @@
 # add the path(es) here:,
 # ********** OPTIONAL: MODIFY the next lines ***
 # LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3 -I$(INCLUDE_TOP)/stx/libcompat
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libbasic3
 
 
 # if you need any additional defines for embedded C code,
--- a/s/bc.mak	Wed Sep 30 09:03:50 2015 +0100
+++ b/s/bc.mak	Wed Sep 30 09:18:22 2015 +0100
@@ -35,7 +35,7 @@
 
 
 
-LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3 -I$(INCLUDE_TOP)\stx\libcompat
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libbasic3
 LOCALDEFINES=
 
 STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES)  -varPrefix=$(LIBNAME)
--- a/s/jv_calipel_s.st	Wed Sep 30 09:03:50 2015 +0100
+++ b/s/jv_calipel_s.st	Wed Sep 30 09:18:22 2015 +0100
@@ -60,7 +60,6 @@
 
     ^ #(
         #'stx:libbasic3'    "MessageTally - referenced by BenchmarkExecutor>>spy:"
-        #'stx:libcompat'    "DateAndTime - referenced by BenchmarkResultC>>initializeTimestamp"
     )
 !