Timestamp.st
changeset 17081 410da5291dea
parent 17079 76e263370574
child 17131 d950d092d386
--- a/Timestamp.st	Wed Nov 19 01:28:43 2014 +0100
+++ b/Timestamp.st	Wed Nov 19 10:58:41 2014 +0100
@@ -443,14 +443,14 @@
         or (us-format, for Travis) mm/dd/yyyy hh:mm:ss.iii.
      On error, raise an exception"
 
-    |pos firstNumber secondNumber day month year hour min sec millis usFormat possibeMonthName ch utcOffsetOrNil|
-
-    pos := aStream position.
-    firstNumber := Integer readFrom:aStream onError:[TimeConversionError raiseErrorString:' - integer expected'].
+    |monthOrYear firstNumber secondNumber day month year hour min sec millis usFormat possibeMonthName ch utcOffsetOrNil count|
+
+    count := 0.
+    monthOrYear := aStream throughAnyForWhich:[:ch | count := count+1. ch isDigit and:[count <= 4]].
+    firstNumber := Integer readFrom:monthOrYear onError:[TimeConversionError raiseErrorString:' - integer expected'].
     firstNumber > 31 ifTrue:[
         "/ assume iso8601 format;
-        aStream position:pos.
-        ^ self readIso8601FormatFrom:aStream.
+        ^ self readIso8601FormatFrom:aStream yearAlreadyRead:firstNumber.
     ].
     aStream skipSeparators.
 
@@ -458,7 +458,7 @@
     usFormat := (aStream peek == $/ ).
 
     [(ch := aStream peekOrNil) notNil and:[ch isLetterOrDigit]] whileFalse:[aStream next].
-    ((ch := aStream peekOrNil) notNil and:[ch isDigit]) ifTrue:[
+    (ch notNil and:[ch isDigit]) ifTrue:[
         secondNumber := Integer readFrom:aStream onError:-1.
 
         usFormat ifTrue:[
@@ -468,7 +468,6 @@
             month := secondNumber.
             day := firstNumber.
         ].
-
     ] ifFalse:[
         possibeMonthName := aStream throughAnyForWhich:[:ch | ch isLetter].
         month := Date indexOfMonth:possibeMonthName asLowercase.
@@ -518,24 +517,30 @@
         (min ~~ 0 or:[sec ~~ 0 or:[millis ~~ 0]]) ifTrue:[ TimeConversionError raiseErrorString:' - bad hour' ].
     ].
     utcOffsetOrNil notNil ifTrue:[
-        utcOffsetOrNil := utcOffsetOrNil negated.
         utcOffsetOrNil = 0 ifTrue:[
             "/ utc timestamp
             ^ UtcTimestamp year:year month:month day:day hour:hour minute:min second:sec millisecond:millis
         ].
-        ^ ((TZTimestamp year:year month:month day:day hour:hour minute:min second:sec millisecond:millis) utcOffset:utcOffsetOrNil) - utcOffsetOrNil
+        ^ TZTimestamp new 
+                UTCyear:year month:month day:day hour:hour minute:min second:sec millisecond:millis;
+                utcOffset:utcOffsetOrNil;
+                addSeconds:utcOffsetOrNil.
     ].
     "/ a local timestamp
     ^ self year:year month:month day:day hour:hour minute:min second:sec millisecond:millis.
 
-    "some add hoc formats:
+    "some ad hoc formats:
 
      Timestamp basicReadFrom:'20-2-1995 13:11:06' readStream
      Timestamp basicReadFrom:'20-2-1995 13:11:06.' readStream
+     Timestamp basicReadFrom:'20-feb-1995 13:11:06' readStream
+     Timestamp basicReadFrom:'20-foo-1995 13:11:06' readStream
      (Timestamp basicReadFrom:'10-9-1995 13:11:06' readStream) month    - european
      (Timestamp basicReadFrom:'10/9/1995 13:11:06' readStream) month    - us
      Timestamp basicReadFrom:'20-2-1995 13:11' readStream
      Timestamp basicReadFrom:'20-2-1995 13:11:06.100' readStream
+     Timestamp basicReadFrom:'20-2-1995 13:11:06.100 MESZ' readStream
+     Timestamp basicReadFrom:'20-2-1995 13:11:06.100+0200' readStream
      Timestamp basicReadFrom:'32-2-1995 13:11:06.100' readStream
      Timestamp basicReadFrom:'32-foo-1995 13:11:06.100' readStream
      Timestamp basicReadFrom:'20-13-1995 13:11:06.100' readStream
@@ -551,6 +556,7 @@
      Timestamp basicReadFrom:(Timestamp now printString readStream)
      Timestamp basicReadFrom:'1995-10-20 24:00:00.000' readStream
      Timestamp basicReadFrom:'1995-10-20 12:10:00.000' readStream
+     Timestamp basicReadFrom:'1995-10-20 12:10:00.000-0200' readStream
 
      UtcTimestamp basicReadFrom:'1995-10-20 12:10:00.000' readStream
     "
@@ -1301,71 +1307,76 @@
      asctime-date   = wkday SP date3 SP time SP 4DIGIT
 
      date1          = 2DIGIT SP month SP 4DIGIT
-		      ; day month year (e.g., 02 Jun 1982)
+                      ; day month year (e.g., 02 Jun 1982)
      date2          = 2DIGIT '-' month '-' 2DIGIT
-		      ; day-month-year (e.g., 02-Jun-82)
+                      ; day-month-year (e.g., 02-Jun-82)
      date3          = month SP ( 2DIGIT | ( SP 1DIGIT ))
-		      ; month day (e.g., Jun  2)
+                      ; month day (e.g., Jun  2)
 
      time           = 2DIGIT ':' 2DIGIT ':' 2DIGIT
-		      ; 00:00:00 - 23:59:59
+                      ; 00:00:00 - 23:59:59
 
      wkday          = 'Mon' | 'Tue' | 'Wed'
-		    | 'Thu' | 'Fri' | 'Sat' | 'Sun'
+                    | 'Thu' | 'Fri' | 'Sat' | 'Sun'
 
      weekday        = 'Monday' | 'Tuesday' | 'Wednesday'
-		    | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday'
+                    | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday'
 
      month          = 'Jan' | 'Feb' | 'Mar' | 'Apr'
-		    | 'May' | 'Jun' | 'Jul' | 'Aug'
-		    | 'Sep' | 'Oct' | 'Nov' | 'Dec'
+                    | 'May' | 'Jun' | 'Jul' | 'Aug'
+                    | 'Sep' | 'Oct' | 'Nov' | 'Dec'
 
      Mon, 17 Aug 2009 11:11:15 GMT
 
      however, occasionally, someone presents us with non-UTC strings which include a timezone;
      thus, this also supports:
-	 Mon, 17 Aug 2009 11:11:15 +xxxx
-	 Mon, 17 Aug 2009 11:11:15 -xxxx
+         Mon, 17 Aug 2009 11:11:15 +xxxx
+         Mon, 17 Aug 2009 11:11:15 -xxxx
      and:
-	 Mon, 17 Aug 2009 11:11:15 PST
+         Mon, 17 Aug 2009 11:11:15 PST
     "
 
     |parts indexModifier utcOffsetString utcOffset day year time monthName month|
 
     rfc1123String isEmptyOrNil ifTrue:[^ exceptionBlock value].
 
-    parts := rfc1123String subStrings:Character space.
+    parts := rfc1123String asCollectionOfSubstringsSeparatedBy:Character space.
     parts size == 6 ifTrue:[
-	indexModifier := 0.
+        indexModifier := 0.
     ] ifFalse:[
-	parts size == 5 ifTrue:[
-	    indexModifier := -1.
-	] ifFalse:[
-	    ^ exceptionBlock value
-	].
+        parts size == 5 ifTrue:[
+            indexModifier := -1.
+        ] ifFalse:[
+            ^ exceptionBlock value
+        ].
     ].
 
-    utcOffsetString := (parts at:6 + indexModifier).
-    utcOffset := (self utcOffsetFrom:utcOffsetString) ? 0.
-
     day := Integer readFrom:(parts at:2 + indexModifier) onError:[^ exceptionBlock].
     year := Integer readFrom:(parts at:4 + indexModifier) onError:[^ exceptionBlock].
     time := Time readFrom:(parts at:5 + indexModifier) onError:[^ exceptionBlock].
     monthName := parts at:3 + indexModifier.
 
-    month := (1 to:12) asOrderedCollection detect:[:i |
-	(Date abbreviatedNameOfMonth:i language:#en) sameAs:monthName
-    ] ifNone:[^ exceptionBlock].
-
-    ^ (self
-	fromDate:(Date newDay:day monthIndex:month year:year)
-	andTime:time) + utcOffset
+    month := Date indexOfMonth:monthName language:#en.
+    month = 0 ifTrue:[^ exceptionBlock value].
+
+    utcOffsetString := parts at:6 + indexModifier ifAbsent:nil.
+    utcOffset := self utcOffsetFrom:utcOffsetString.
+
+    (utcOffset isNil or:[utcOffset = 0]) ifTrue:[
+        ^ UtcTimestamp year:year month:month day:day hour:time hour minute:time minute second:time second millisecond:0.
+    ].
+    ^ TZTimestamp new 
+            setOSTimeFromUTCYear:year month:month day:day hour:time hour minute:time minute second:time second millisecond:0;
+            utcOffset:utcOffset;
+            addSeconds:utcOffset.
 
     "
+     self readRFC1123FormatFrom:'Mon, 17 Aug 2009 11:11:15 GMT' onError:nil
+     self readRFC1123FormatFrom:'Mon, 17 Aug 2009 11:11:15 UTC' onError:nil
      self readRFC1123FormatFrom:'Mon, 17 Aug 2009 11:11:15 PST' onError:nil
      self readRFC1123FormatFrom:'Mon, 17 Aug 2009 11:11:15 PDT' onError:nil
-     self readRFC1123FormatFrom:'Mon, 17 Aug 2009 11:11:15 UTC' onError:nil
      self readRFC1123FormatFrom:'Mon, 17 Aug 2009 11:11:15 +0100' onError:nil
+     self readRFC1123FormatFrom:'17 Aug 2009 11:11:15 +0100' onError:nil
     "
 
     "Modified: / 05-10-2010 / 16:05:32 / cg"
@@ -1382,151 +1393,151 @@
      the end so they match last."
 
     ^ #(
-	    'Z'     0                 "/ zulu
-	    'UTC'   0
-	    'GMT'   0
-
-	    "/ US
-	    'HAST'  -10                "/ hawai standard
-	    'AKST'   -9                "/ alaska standard
-	    'YST'   -9                 "/ yukon standard
-	    'PST'   -8                 "/ pacific standard
-	    'PT'    -8                 "/ pacific standard
-	    'MST'   -7                 "/ mountain standard
-	    'CST'   -6                 "/ central standard
-	    'EST'   -5                 "/ eastern standard
-	    'AST'   -4                 "/ atlantic standard
-
-	    'NST'   -3.5               "/ new foundland standard
-	    'PMST'  -3                 "/ pierre & miquelon
-	    'WGT'   -3                 "/ west greenland
-	    'EGT'   -1                 "/ east greenland
-
-	    "/ europe
-	    'CET'   1                 "/ central european
-	    'EET'   2                 "/ east european
-	    'WET'   0                  "/ west european
-	    "/ conflict with india!!
-	    "/ 'IST'   1               "/ irish standard time
-	    "/ 'IST'   1               "/ israel standard time
-	    'AZOT'   -1                "/ azores standard
-
-	    'MSK'   4                  "/ moscow european
-	    'MSD'   4
-	    'BT'    4                  "/ baghdad
-
-	    "/ pacific
-	    'NZST' 12                 "/ new zealand standard
-	    'FJT' 12                  "/ fiji
-
-	    "/ south america
-	    'ART'   -3                 "/ argentina
-	    'BOT'   -4                 "/ bolivia
-	    'BRT'   -3                 "/ brasilia
-	    'CLT'   -4                 "/ chile
-	    'ECT'   -5                 "/ equador
-	    'PET'   -5                 "/ peru
-	    'PYT'   -4                 "/ paraguay
-	    'UYT'   -3                 "/ uruguay
-	    'VET'   -4.5               "/ venezuela standard
-	    'VST'   -4.5               "/ venezuela standard
-
-	    "/ africa
-	    'CAT'   2                 "/ central africa
-	    'EAT'   3                 "/ east africa
-	    'SAST'  2                 "/ south africa standard
-	    'WAT'   1                 "/ west africa
-	    'WT'    0                 "/ west sahara standard
-
-	    'AST'   3                 "/ arabia
-	    'IRT'   3.5                "/ iran time
-	    'AFT'   4.5               "/ afghanistan time
-
-	    'HKT'   8                 "/ hongkong
-	    'IST'   5.5               "/ india standard
-	    'ICT'   7                 "/ indochina
-	    'CNST'  8                 "/ china standard
-	    'JST'   9                 "/ japan standard
-	    'KST'   9                 "/ korea standard
-	    'SGT'   8                 "/ singapore
-	    'MYT'   8                 "/ malaysia
-	    'AWST'  8                 "/ australian west standard
-	    'ACWST' 8.75              "/ australian central western standard
-	    'ACST'  9.5               "/ australian central standard
-	    'AEST'  10                "/ australian east standard
-	    'NFT'   11.5              "/ norfolk island, australia
-
-	    'CHAST' 12.75             "/ chatham island standard
-	    'WST'   13                "/ west samoa - yes thats 13!!
-	    'TOT'   13                "/ tonga - yes thats 13!!
-	    'TKT'   13                "/ tokelau - yes thats 13!!
-	    'LINT'   14               "/ line islands - yes thats 14!!
-
-	    "/ misc
-	    'IDLW'  -12               "/ international date line west
-	    'IDLE'  12                "/ international date line east
-
-	    "/ military
-	    'A'     1                 "/ alpha
-	    'B'     2                 "/ bravo
-	    'C'     3                 "/ charlie
-	    'D'     4                 "/ delta
-	    'E'     5                 "/ echo
-	    'F'     6                 "/ foxtrot
-	    'G'     7                 "/ golf
-	    'H'     8                 "/ hotel
-	    'I'     9                 "/ also called india - how misleading
-	    'K'     10                "/ kilo
-	    'L'     11                "/ lima - but not there
-	    'M'     12                "/ mike
-	    'N'     -1                "/ november (but also in other months)
-	    'O'     -2                "/ oscar
-	    'P'     -3                "/ papa (not mama)
-	    'Q'     -4                "/ quebec - really?
-	    'R'     -5                "/ romeo and juliet
-	    'S'     -6                "/ sierra
-	    'T'     -7                "/ tango (&rumba)
-	    'U'     -8                "/ uniform
-	    'V'     -9                "/ victor
-	    'W'     -10               "/ whiskey (scotch?)
-	    'X'     -11               "/ xray
-	    'Y'     -12               "/ yankee
-
-	    'MEZ'   1                 "/ central european (german)
-	    'MESZ'  2                 "/ central european summer (german)
-	    'WESZ'  1                 "/ west european summer (german)
-
-	    'WEZ'   0                 "/ west european (german)
-
-	    'HADT'  -9                "/ hawaii summer
-	    'ADT'   -3
-	    'AKDT'  -9                "/ alaska summer
-	    'YDT'   -8                "/ yukon summer
-	    'PDT'   -7                "/ pacific daylight saving
-	    'MDT'   -6                "/ mountain daylight saving
-	    'CDT'   -5                "/ central daylight saving
-	    'EDT'   -4                "/ eastern daylight saving
-	    'CLST'  -3                "/ chile summer
-	    'NDT'   -2.5
-	    'PMDT'  -2
-	    'BRST'  -2                "/ brasilia summer
-	    'WGST'  -2                "/ west greenland summer
-	    'EGST'   0                "/ east greenland summer
-	    'AZOST'  0                "/ azores summer
-	    'EEST'  3
-	    'CEST'  2
-	    'WAST'  2                 "/ west africa summer
-	    "/ 'WST'   1                 "/ west sahara summer - conflict with west samoa
-	    'WEST'  1
-	   'BST'   1                 "/ british summer time
-	    'IRST'  4.5               "/ iran summer time
-	    'AWDT'  9                 "/ australian west daylight saving
-	    'ACDT'  10.5              "/ australian central daylight saving
-	    'AEDT'  11                "/ australian east daylight saving
-	    'CHADT'   13.75           "/ chatham island daylight saving
-	    'FJST' 13                 "/ fiji summer
-	    'NZDT'  13                "/ new zealand summer
-	).
+            'Z'     0                 "/ zulu
+            'UTC'   0
+            'GMT'   0
+
+            "/ US
+            'HAST' -10                 "/ hawai standard
+            'AKST'  -9                 "/ alaska standard
+            'YST'   -9                 "/ yukon standard
+            'PST'   -8                 "/ pacific standard
+            'PT'    -8                 "/ pacific standard
+            'MST'   -7                 "/ mountain standard
+            'CST'   -6                 "/ central standard
+            'EST'   -5                 "/ eastern standard
+            'AST'   -4                 "/ atlantic standard
+
+            'NST'   -3.5               "/ new foundland standard
+            'PMST'  -3                 "/ pierre & miquelon
+            'WGT'   -3                 "/ west greenland
+            'EGT'   -1                 "/ east greenland
+
+            "/ europe
+            'CET'   1                  "/ central european
+            'EET'   2                  "/ east european
+            'WET'   0                  "/ west european
+            "/ conflict with india!!
+            "/ 'IST'   1               "/ irish standard time
+            "/ 'IST'   1               "/ israel standard time
+            'AZOT'   -1                "/ azores standard
+
+            'MSK'   4                  "/ moscow european
+            'MSD'   4
+            'BT'    4                  "/ baghdad
+
+            "/ pacific
+            'NZST' 12                 "/ new zealand standard
+            'FJT' 12                  "/ fiji
+
+            "/ south america
+            'ART'   -3                 "/ argentina
+            'BOT'   -4                 "/ bolivia
+            'BRT'   -3                 "/ brasilia
+            'CLT'   -4                 "/ chile
+            'ECT'   -5                 "/ equador
+            'PET'   -5                 "/ peru
+            'PYT'   -4                 "/ paraguay
+            'UYT'   -3                 "/ uruguay
+            'VET'   -4.5               "/ venezuela standard
+            'VST'   -4.5               "/ venezuela standard
+
+            "/ africa
+            'CAT'   2                 "/ central africa
+            'EAT'   3                 "/ east africa
+            'SAST'  2                 "/ south africa standard
+            'WAT'   1                 "/ west africa
+            'WT'    0                 "/ west sahara standard
+
+            'AST'   3                 "/ arabia
+            'IRT'   3.5               "/ iran time
+            'AFT'   4.5               "/ afghanistan time
+
+            'HKT'   8                 "/ hongkong
+            'IST'   5.5               "/ india standard
+            'ICT'   7                 "/ indochina
+            'CNST'  8                 "/ china standard
+            'JST'   9                 "/ japan standard
+            'KST'   9                 "/ korea standard
+            'SGT'   8                 "/ singapore
+            'MYT'   8                 "/ malaysia
+            'AWST'  8                 "/ australian west standard
+            'ACWST' 8.75              "/ australian central western standard
+            'ACST'  9.5               "/ australian central standard
+            'AEST'  10                "/ australian east standard
+            'NFT'   11.5              "/ norfolk island, australia
+
+            'CHAST' 12.75             "/ chatham island standard
+            'WST'   13                "/ west samoa - yes thats 13!!
+            'TOT'   13                "/ tonga - yes thats 13!!
+            'TKT'   13                "/ tokelau - yes thats 13!!
+            'LINT'  14               "/ line islands - yes thats 14!!
+
+            "/ misc
+            'IDLW' -12               "/ international date line west
+            'IDLE'  12                "/ international date line east
+
+            "/ military
+            'A'     1                 "/ alpha
+            'B'     2                 "/ bravo
+            'C'     3                 "/ charlie
+            'D'     4                 "/ delta
+            'E'     5                 "/ echo
+            'F'     6                 "/ foxtrot
+            'G'     7                 "/ golf
+            'H'     8                 "/ hotel
+            'I'     9                 "/ also called india - how misleading
+            'K'     10                "/ kilo
+            'L'     11                "/ lima - but not there
+            'M'     12                "/ mike
+            'N'     -1                "/ november (but also in other months)
+            'O'     -2                "/ oscar
+            'P'     -3                "/ papa (not mama)
+            'Q'     -4                "/ quebec - really?
+            'R'     -5                "/ romeo and juliet
+            'S'     -6                "/ sierra
+            'T'     -7                "/ tango (&rumba)
+            'U'     -8                "/ uniform
+            'V'     -9                "/ victor
+            'W'     -10               "/ whiskey (scotch?)
+            'X'     -11               "/ xray
+            'Y'     -12               "/ yankee
+
+            'MEZ'   1                 "/ central european (german)
+            'MESZ'  2                 "/ central european summer (german)
+            'WESZ'  1                 "/ west european summer (german)
+
+            'WEZ'   0                 "/ west european (german)
+
+            'HADT'  -9                "/ hawaii summer
+            'ADT'   -3
+            'AKDT'  -9                "/ alaska summer
+            'YDT'   -8                "/ yukon summer
+            'PDT'   -7                "/ pacific daylight saving
+            'MDT'   -6                "/ mountain daylight saving
+            'CDT'   -5                "/ central daylight saving
+            'EDT'   -4                "/ eastern daylight saving
+            'CLST'  -3                "/ chile summer
+            'NDT'   -2.5
+            'PMDT'  -2
+            'BRST'  -2                "/ brasilia summer
+            'WGST'  -2                "/ west greenland summer
+            'EGST'   0                "/ east greenland summer
+            'AZOST'  0                "/ azores summer
+            'EEST'   3
+            'CEST'   2
+            'WAST'   2                "/ west africa summer
+            "/ 'WST'   1                 "/ west sahara summer - conflict with west samoa
+            'WEST'  1
+            'BST'   1                 "/ british summer time
+            'IRST'  4.5               "/ iran summer time
+            'AWDT'  9                 "/ australian west daylight saving
+            'ACDT'  10.5              "/ australian central daylight saving
+            'AEDT'  11                "/ australian east daylight saving
+            'CHADT' 13.75             "/ chatham island daylight saving
+            'FJST'  13                "/ fiji summer
+            'NZDT'  13                "/ new zealand summer
+        ).
 !
 
 utcOffsetFrom:aStringOrStream
@@ -1535,7 +1546,7 @@
 
      Notice: this returns the negated value of what is read from a printed representation,
      which means that the sign is the same as what the utcOffset instance variable
-     in timeStamp and OperatingSydtem-timeInfo will be.
+     in timeStamp and OperatingSystem-timeInfo will be.
 
      If utcOffset is negative, the local timezone is east of Greenwich.
      If utcOffset is positive, the local timezone is west of Greenwich.
@@ -1543,16 +1554,17 @@
      UtcOffset is what you have to ADD to correct the printed time to GMT.
      I.e. for Germany, you'll get -3600 (+01h), for NewYork, you'll get +18000 (-05h)"
 
-    |ch table i offset stream tzName sign|
-
-    table := self timezoneInfo.
+    |ch offset stream|
 
     stream := aStringOrStream readStream.
     stream skipSeparators.
 
     ch := stream peekOrNil.
     ch isNil ifTrue:[^ 0].
+
     ch isLetter ifTrue:[
+        |table tzName i|
+        table := self timezoneInfo.
         tzName := stream upToElementForWhich:[:ch | ch isLetter not].
 
         i := table indexOf:tzName.
@@ -1561,21 +1573,22 @@
         ].
         offset := (table at:i+1) * 60 * 60
     ] ifFalse:[
+        |sign|
+
         sign := 1.
         ch == $- ifTrue:[
             sign := -1.
             stream next.
+        ] ifFalse:[ch == $+ ifTrue:[
+            stream next.
         ] ifFalse:[
-            ch == $+ ifTrue:[
-                sign := 1.
-                stream next.
-            ] ifFalse:[
-                stream skipSeparators
-            ]
-        ].
+            stream skipSeparators
+        ]].
+
         offset := ((stream next:2) asNumber * 60 * 60).
-        stream peekOrNil notNil ifTrue:[
-            stream peek == $: ifTrue:[ stream next ].
+        ch := stream peekOrNil.
+        ch notNil ifTrue:[
+            ch == $: ifTrue:[ stream next ].
             offset := offset + ((stream next:2) asNumber * 60).
         ].
         offset := offset * sign
@@ -1591,6 +1604,7 @@
      self utcOffsetFrom:'CET'
      self utcOffsetFrom:'+0130'
      self utcOffsetFrom:'+01:30'
+     self utcOffsetFrom:'+1:30'
      self utcOffsetFrom:'+01'
     "
 !
@@ -2196,13 +2210,21 @@
      but will represent itself as a timestamp in the given timezone.
      timeZoneName must be one of the standard names as listed in Timestamp >> timezoneInfo"
 
-    ^ self asTZTimestamp:(Timestamp utcOffsetFrom:timeZoneName)
+    |utcOffset|
+
+    utcOffset := self class utcOffsetFrom:timeZoneName.
+    utcOffset isNil ifTrue:[
+        ^ TimeConversionError raiseRequestWith:self errorString:(' - Invalid timzone: %1' bindWith:timeZoneName)
+    ].
+
+    ^ self asTZTimestamp:utcOffset
 
     "what is the time now in NewYork?
      Timestamp now asTZTimestampInZone:'EST'
 
      what is the time now in Stuttgart?
      Timestamp now asTZTimestampInZone:'MEZ'
+     Timestamp now asTZTimestampInZone:'BlaBla'
     "
 !
 
@@ -3919,11 +3941,11 @@
 !Timestamp class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.205 2014-11-18 21:19:34 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.206 2014-11-19 09:58:41 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.205 2014-11-18 21:19:34 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.206 2014-11-19 09:58:41 stefan Exp $'
 ! !