From eef18e13871e83f17d5cbd46f013e655f42686c5 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 23 Jul 2022 13:43:37 -0500 Subject: [PATCH] Improved encoding for creation date, that can be used as uid. --- repository/TiddlyWiki/Tiddler.class.st | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st index 90f29af..d16e808 100644 --- a/repository/TiddlyWiki/Tiddler.class.st +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -119,6 +119,24 @@ Tiddler >> created: anObject [ created := anObject ] +{ #category : #accessing } +Tiddler >> createdAsTWFormat [ + ^ ((ZTimestampFormat fromString: '20010203160506700') + format: (ZTimestamp fromString: self created)) copyFrom: 1 to: 17 +] + +{ #category : #accessing } +Tiddler >> createdEncoded [ + | output longDate | + longDate := self createdAsTWFormat. + output := '' writeStream. + 1 to: 14 by: 2 do: [ :i | + output nextPutAll: (longDate copyFrom: i to: i +1 ) asInteger asCharacterDigit asString + ]. + output nextPutAll: ((longDate copyFrom: 15 to: 17)). + ^ output contents +] + { #category : #accessing } Tiddler >> creator [