core: use `Timestamp` instead of (Pharo) `DateAndTime`
authorJan Vrany <jan.vrany@labware.com>
Wed, 23 Dec 2020 08:46:20 +0000
changeset 10 1fa4cd506c87
parent 9 d64df1abdf2a
child 11 7af77235bf17
core: use `Timestamp` instead of (Pharo) `DateAndTime`
core/RGComment.st
core/RGMethod.st
core/RGStampParser.st
core/tests/RGAnnouncementsTest.st
core/tests/RGCommentTest.st
core/tests/RGMethodTest.st
core/tests/RGReadOnlyImageBackendTest.st
core/tests/RGStampParserTest.st
--- a/core/RGComment.st	Fri Dec 18 12:22:51 2020 +0000
+++ b/core/RGComment.st	Wed Dec 23 08:46:20 2020 +0000
@@ -78,7 +78,8 @@
 
 defaultTime
 
-    ^ DateAndTime new
+    ^ Timestamp epoch
+
 ! !
 
 !RGComment methodsFor:'initialization'!
--- a/core/RGMethod.st	Fri Dec 18 12:22:51 2020 +0000
+++ b/core/RGMethod.st	Wed Dec 23 08:46:20 2020 +0000
@@ -217,7 +217,7 @@
 
 defaultTime
 
-    ^ DateAndTime new
+    ^ Timestamp epoch
 ! !
 
 !RGMethod methodsFor:'error handling'!
--- a/core/RGStampParser.st	Fri Dec 18 12:22:51 2020 +0000
+++ b/core/RGStampParser.st	Wed Dec 23 08:46:20 2020 +0000
@@ -129,11 +129,11 @@
 timeForStamp: stamp
 
     ^ stamp
-        ifNil: [ 	DateAndTime new]
+        ifNil: [ Timestamp epoch ]
         ifNotNil: [ 
             | substrings |
             substrings := stamp substrings.
-            ([(DateAndTime fromString: (' ' join: substrings allButFirst ))] on: Exception do: [DateAndTime epoch]) ]. 
+            ([(DateAndTime fromString: (' ' join: substrings allButFirst ))] on: Exception do: [Timestamp epoch]) ]. 
     
 ! !
 
--- a/core/tests/RGAnnouncementsTest.st	Fri Dec 18 12:22:51 2020 +0000
+++ b/core/tests/RGAnnouncementsTest.st	Wed Dec 23 08:46:20 2020 +0000
@@ -31,7 +31,7 @@
 
     | env announcements start end |
     
-    start := DateAndTime now.
+    start := Timestamp now.
     env := RGEnvironment new.
     announcements := OrderedCollection new.
     env announcer when: ClassAdded do: [ :announcement | announcements add: announcement ].
@@ -40,7 +40,7 @@
     10 milliSeconds wait.
     env ensureClassNamed: #SomeClass2.
 
-    end := DateAndTime now.
+    end := Timestamp now.
 
     self assert: (announcements size >=2).
     self assert: (announcements allSatisfy: [:each | each timeStamp between: start and: end] ).
@@ -107,7 +107,7 @@
     behavior comment content: 'some comment'.
     self assert: announcements size equals: 1.
     behavior comment author: 'SomeAuthor'.
-    behavior comment time: DateAndTime new.
+    behavior comment time: Timestamp epoch.
     self assert: announcements size equals: 3.
     self assert: (announcements allSatisfy: [:each | each classCommented == behavior ]).
     
--- a/core/tests/RGCommentTest.st	Fri Dec 18 12:22:51 2020 +0000
+++ b/core/tests/RGCommentTest.st	Wed Dec 23 08:46:20 2020 +0000
@@ -1,3 +1,6 @@
+"
+COPYRIGHT (c) 2020 LabWare
+"
 "{ Package: 'stx:goodies/ring/core/tests' }"
 
 "{ NameSpace: Smalltalk }"
@@ -9,8 +12,15 @@
 	category:'Ring-Tests-Core'
 !
 
-RGCommentTest comment:''
-!
+!RGCommentTest class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2020 LabWare
+
+
+"
+! !
 
 !RGCommentTest methodsFor:'tests'!
 
@@ -56,8 +66,9 @@
     self assert: comment unresolvedProperties isEmpty.
     self assert: comment content equals: ''.
     self assert: comment author equals: ''.
-    self assert: (comment time isKindOf: DateAndTime).
-    
+    self assert: (comment time isKindOf: Timestamp).
+
+    "Modified: / 22-12-2020 / 20:13:04 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 testNewComment
@@ -84,8 +95,8 @@
     self assert: (comment hasUnresolvedAll: #(time name)).
     self assert: comment author equals: 'FullAuthorName'.
     
-    time := DateAndTime now.
-    self assert: comment time equals: DateAndTime new.
+    time := Timestamp now.
+    self assert: comment time equals: Timestamp epoch.
     comment time: time.
     self assert: (comment hasUnresolved: #name).
     self assert: comment time equals: time.
@@ -117,10 +128,17 @@
     self assert: (comment hasUnresolvedAll: #(time name)).
     self assert: comment author equals: 'FullAuthorName'.
     
-    time := DateAndTime now.
-    self assert: comment time equals: DateAndTime new.
+    time := Timestamp now.
+    self assert: comment time equals: Timestamp epoch.
     comment time: time.
     self assert: (comment hasUnresolved: #name).
     self assert: comment time equals: time.
 ! !
 
+!RGCommentTest class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/core/tests/RGMethodTest.st	Fri Dec 18 12:22:51 2020 +0000
+++ b/core/tests/RGMethodTest.st	Wed Dec 23 08:46:20 2020 +0000
@@ -110,8 +110,8 @@
     self assert: (method hasUnresolvedAll: #(time name)).
     self assert: method author equals: 'FullAuthorName'.
     
-    time := DateAndTime now.
-    self assert: method time equals: DateAndTime new.
+    time := Timestamp now.
+    self assert: method time equals: Timestamp epoch.
     method time: time.
     self assert: (method hasUnresolved: #name).
     self assert: method time equals: time.
--- a/core/tests/RGReadOnlyImageBackendTest.st	Fri Dec 18 12:22:51 2020 +0000
+++ b/core/tests/RGReadOnlyImageBackendTest.st	Wed Dec 23 08:46:20 2020 +0000
@@ -236,8 +236,8 @@
     
     comment content notEmpty.
     comment author notEmpty.
-    comment time > DateAndTime new.
-    comment time <= DateAndTime now.
+    comment time > Timestamp epoch.
+    comment time <= Timestamp now.
     
     
 !
@@ -282,7 +282,7 @@
     method := Point >> #x asRingMinimalDefinitionIn: env.
 
     self assert: method author notEmpty.
-    self assert: (method time <= DateAndTime now).
+    self assert: (method time <= Timestamp now).
     self assert: method selector equals: #x.
     self assert: (method package isRGObject and: [ method package isPackage ]).
     self assert: method package name equals: 'Kernel'.
--- a/core/tests/RGStampParserTest.st	Fri Dec 18 12:22:51 2020 +0000
+++ b/core/tests/RGStampParserTest.st	Wed Dec 23 08:46:20 2020 +0000
@@ -1,3 +1,6 @@
+"
+COPYRIGHT (c) 2020 LabWare
+"
 "{ Package: 'stx:goodies/ring/core/tests' }"
 
 "{ NameSpace: Smalltalk }"
@@ -9,8 +12,15 @@
 	category:'Ring-Tests-Core'
 !
 
-RGStampParserTest comment:''
-!
+!RGStampParserTest class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2020 LabWare
+
+
+"
+! !
 
 !RGStampParserTest methodsFor:'tests'!
 
@@ -24,7 +34,15 @@
 testTime
 
     "TODO: improve"
-    self assert: (RGStampParser parseTimestampFrom: '11/10/2015 18:13') equals: '2015-11-10T18:13:00' asDateAndTime.
-    
+    self assert: (RGStampParser parseTimestampFrom: '11/10/2015 18:13') equals: '2015-11-10T18:13:00' asTimestamp.
+
+    "Modified: / 22-12-2020 / 13:15:54 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
+!RGStampParserTest class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+