# HG changeset patch # User Claus Gittinger # Date 1580415004 -3600 # Node ID b6b8db23fd8f031ee7a39f8a938f17f4fc454b50 # Parent 7e4c664a7697ccd32dc6481f01bb0a4577b58350 #FEATURE by cg class: Timestamp::TimestampBuilderAbstract added: #dateAlreadyReadAs: class: Timestamp::TimestampBuilderAbstract class removed: #examples comment/format in: #documentation class: Timestamp::TimestampISO8601Builder added: #stream: class: Timestamp::TimestampISO8601Builder class comment/format in: #read:withClass: #read:withClass:yearAlreadyReadAs: diff -r 7e4c664a7697 -r b6b8db23fd8f Timestamp.st --- a/Timestamp.st Thu Jan 30 12:50:06 2020 +0100 +++ b/Timestamp.st Thu Jan 30 21:10:04 2020 +0100 @@ -660,6 +660,7 @@ " ! ! + !Timestamp class methodsFor:'private'! basicReadFrom:aStream @@ -1998,6 +1999,7 @@ ! ! + !Timestamp methodsFor:'accessing'! day @@ -3778,6 +3780,8 @@ ^ Timestamp ! ! + + !Timestamp methodsFor:'testing'! isLocalTimestamp @@ -3820,28 +3824,7 @@ documentation " - documentation to be added. - - [author:] - cg - - [instance variables:] - - [class variables:] - - [see also:] - -" -! - -examples -" - - more examples to be added: - [exBegin] - ... add code fragment for - ... executable example here ... - [exEnd] + abstract timestamp reader support " ! ! @@ -3911,6 +3894,16 @@ "Modified: / 16-06-2005 / 15:04:45 / masca" ! +dateAlreadyReadAs:date + "support for readers which may have already preread the date" + + year := date year. + yearAlreadyRead := true. + month := date month. + day := date day. + millisecond := second := minute := hour := picos := 0. +! + dateFromDayNumber: dayInYear "Set month and day from an absolute number of the day in the year. 1.1. is day number one." @@ -4513,22 +4506,28 @@ !Timestamp::TimestampISO8601Builder class methodsFor:'public parsing'! -read: stringOrStream withClass:timestampClass +read:stringOrStream withClass:timestampClass ^ self new read:stringOrStream withClass:timestampClass "Created: / 15-06-2005 / 17:52:03 / masca" ! -read: stringOrStream withClass:timestampClass yearAlreadyReadAs:yearArg +read:stringOrStream withClass:timestampClass yearAlreadyReadAs:yearArg "support for readers which may have already preread the year" ^ self new - yearAlreadyReadAs:yearArg; - read:stringOrStream withClass:timestampClass + yearAlreadyReadAs:yearArg; + read:stringOrStream withClass:timestampClass "Created: / 15-06-2005 / 17:52:03 / masca" ! ! +!Timestamp::TimestampISO8601Builder methodsFor:'accessing'! + +stream:something + stream := something. +! ! + !Timestamp::TimestampISO8601Builder methodsFor:'private-reading'! nextDigit