class: Timestamp
authorClaus Gittinger <cg@exept.de>
Mon, 10 Nov 2014 17:56:00 +0100
changeset 17016 da04a2484c16
parent 17015 f7c4867a3633
child 17017 f6a1e6eb666e
class: Timestamp
Timestamp.st
--- a/Timestamp.st	Mon Nov 10 17:33:14 2014 +0100
+++ b/Timestamp.st	Mon Nov 10 17:56:00 2014 +0100
@@ -3004,38 +3004,37 @@
 timestampWithClass:timestampClass
     "Answer the timestamp as it has been parsed."
     "Notes:
-     - When reading, the time has either been adjusted to UTZ/zulu time,
-       or is a local time.
-     - On UNIX, timestamps can only hold dates between 1970-01-01T00:00:00Z and 2038-01-19T00:00:00Z"
+     - When reading, the time has either been adjusted to UTZ/zulu or explicit offset time,
+       or is a local time stamp.
+     Attention: an explicit utcOffset in the input string has already been added into the hh:mm values."
 
     (timestampClass == UtcTimestamp) ifTrue:[
-	^ UtcTimestamp
-	    UTCYear: year month: month day: day
-	    hour: hour minute: minute second: second millisecond: millisecond
+        ^ UtcTimestamp
+            UTCYear: year month: month day: day
+            hour: hour minute: minute second: second millisecond: millisecond
     ].
     (timestampClass == TZTimestamp) ifTrue:[
-	^ (TZTimestamp
-	    UTCYear: year month: month day: day
-	    hour: hour minute: minute second: second millisecond: millisecond) utcOffset:utcOffset
+        "/ Attention: an explicit utcOffset in the input string has already been added into the hh:mm values."
+        ^ ((TZTimestamp
+            UTCYear: year month: month day: day
+            hour: hour minute: minute second: second millisecond: millisecond) utcOffset:utcOffset)
     ].
 
     (isUtcTime or:[hasTimezone and:[utcOffset == 0]]) ifTrue:[
-	^ ((timestampClass == Timestamp) ifTrue:UtcTimestamp ifFalse:timestampClass)
-	    UTCYear: year month: month day: day
-	    hour: hour minute: minute second: second millisecond: millisecond
-    ] ifFalse:[
-	hasTimezone ifTrue:[
-	    ^ (((timestampClass == Timestamp) ifTrue:TZTimestamp ifFalse:timestampClass)
-		UTCYear: year month: month day: day
-		hour: hour minute: minute second: second millisecond: millisecond) utcOffset:utcOffset
-	].
-	^ timestampClass
-	    year: year month: month day: day
-	    hour: hour minute: minute second: second millisecond: millisecond
-    ]
-
-    "Created: / 15-06-2005 / 15:39:24 / masca"
-    "Modified: / 30-06-2005 / 16:48:25 / masca"
+        ^ ((timestampClass == Timestamp) ifTrue:UtcTimestamp ifFalse:timestampClass)
+            UTCYear: year month: month day: day
+            hour: hour minute: minute second: second millisecond: millisecond
+    ].
+    hasTimezone ifTrue:[
+        "/ Attention: an explicit utcOffset in the input string has already been added into the hh:mm values."
+        ^ (((timestampClass == Timestamp) ifTrue:TZTimestamp ifFalse:timestampClass)
+            UTCYear: year month: month day: day
+            hour: hour minute: minute second: second millisecond: millisecond) utcOffset:utcOffset  
+    ].
+    "/ there was no timezone info, so make it a local timestamp again.    
+    ^ (timestampClass
+        year: year month: month day: day
+        hour: hour minute: minute second: second millisecond: millisecond) 
 !
 
 yearAlreadyReadAs:yearArg
@@ -3824,11 +3823,11 @@
 !Timestamp class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.197 2014-11-10 15:53:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.198 2014-11-10 16:56:00 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.197 2014-11-10 15:53:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.198 2014-11-10 16:56:00 cg Exp $'
 ! !