--- a/Timestamp.st Thu Aug 13 10:01:01 2009 +0200
+++ b/Timestamp.st Thu Aug 13 10:45:02 2009 +0200
@@ -417,6 +417,32 @@
onError:exceptionValue
!
+readRFC1123FormatFrom:rfc1123String onError:exceptionBlock
+ |parts day year time monthName month|
+
+ self error:'not completly implemented, please wait for newer version'.
+
+ rfc1123String isEmptyOrNil ifTrue:[^ exceptionBlock value].
+
+ parts := rfc1123String subStrings:Character space.
+ parts size ~~ 6 ifTrue:[^ exceptionBlock value].
+ self halt.
+ (parts at:6) = 'GMT' ifFalse:[^ exceptionBlock value].
+
+ day := Integer readFrom:(parts at:2) onError:[^ exceptionBlock].
+ year := Integer readFrom:(parts at:4) onError:[^ exceptionBlock].
+ time := Time readFrom:(parts at:5) onError:[^ exceptionBlock].
+ monthName := parts at:3.
+
+ month := (1 to:12) asOrderedCollection detect:[:i |
+ (Date abbreviatedNameOfMonth:i language:#en) sameAs:monthName
+ ] ifNone:[^ exceptionBlock].
+
+ ^ Timestamp
+ fromDate:(Date newDay:day monthIndex:month year:year)
+ andTime:time
+!
+
secondsSince1970:sec
"set time from elapsed seconds since 1-1-1970, 0:0:0.
This is the format used in the UNIX world"
@@ -1406,6 +1432,7 @@
"
! !
+
!Timestamp methodsFor:'visiting'!
acceptVisitor:aVisitor with:aParameter
@@ -1416,7 +1443,7 @@
!Timestamp class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.116 2008-09-26 10:57:30 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Timestamp.st,v 1.117 2009-08-13 08:45:02 sr Exp $'
! !
Timestamp initialize!