3.5.2 and MATimeStampDescription

Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

3.5.2 and MATimeStampDescription

Tobias Pape
Hi all

I have just uploaded a new config, and called it version 3.5.2.
Essential change:

  Split out Trait extensions FileSystem/Directory detection and load only when supported.
  - Traits are supporten in Pharo and Squek (but only when loaded).
  - FileSystem is in all newer Pharo but could be loaded in Pharo 1.0 and Squeak, GemStone and Squeak have FileDriectory by default'

This makes it possible to properly load in Squeak and neatly have the dependencies more "capability"-based.
This is because Squeak can live with and without Traits or FileSystem.
Another goal was to Un-break GemStone a bit more, but not too much progress here.

The effect is that the tests for the external file model are now centralized, and the implementation in
Magritte-FileDirectory (for Squeak/GemStone), Magritte-FileSystem (for squeak, pharo-1 and pharo-2), and (traditional way) Magritte-Pharo3-Model).

If this is not to your liking, please tell and I'll reverse this.

Also, I found a problem with using DateAndTime as timestamp 'backend' in Pharo.
The problem is, that we loose information, should ever a DateAndTime be used that uses a local offset, and, sadly, that is almost every one.

Here's a snipped to illustrate:

|d t tz text |
tz := DateAndTime localTimeZone.
[d :=  MATimeStampDescription new
                accessor: MANullAccessor new;
t := GRPlatform current magritteTimeStampClass current.
text := d toString: t.
DateAndTime localTimeZone: (TimeZone offset: -8 hours name: 'Pacific Standard Time' abbreviation: 'PST').
(d fromString:  text) = t
] ensure:  [ DateAndTime localTimeZone: tz ].

You will get false, but we want true.
Sadly, this also holds for Squeak.

We could force a timeszone designator at the end of the to-string-converted version (like this
MAStringWriter>>visitTimeStampDescription: aDescription
        self stream print: self object asDate; space.
        self stream print: self object asTime; space.
(self object offset ~= Duration zero)
                ifTrue: [self stream
                        nextPut: (self object offset positive ifTrue: [$+] ifFalse: [$-]);
                        nextPutAll: (self object offset hours abs asString padLeftTo: 2 with: $0);
                        nextPutAll: (self object offset minutes abs asString padLeftTo: 2 with: $0)]
                ifFalse: [self stream nextPut: $Z]

) which would fix it for pharo.

But i really think that it would be better to force an ISO format, which should have explicit timezone (or 'Z' for that matter).


Best regards

Magritte, Pier and Related Tools ...