DateAndTime, Duration, and TimeZoneInfo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

DateAndTime, Duration, and TimeZoneInfo

James Foster-3

At GemStone we are updating our implementation of TimeZone to better handle the various rules for "daylight savings time," especially the USA change for 2007. This is being done partly by reading the ZoneInfo database used on Linux, Java, and a number of other platforms. In conjunction with this work we are implementing the ANSI DateAndTime and Duration classes. We note that while there are some goodies available (most notably Chronos), most other vendors do not have these classes as part of the base image. In order to encourage a common implementation GemStone is making these classes available under the MIT license and porting them to a couple other dialects (VW and Dolphin; VA Smalltalk has the ANSI classes, and we have an Application with TimeZoneInfo available).

 

A preliminary version is available for VW in the Cincom Public Store as DateAndTime. If you are interested in the implementation for Dolphin, VA, or GS/S, please contact me. Comments, suggestions, additions, and fixes are welcome.

 

[hidden email]

 

Reply | Threaded
Open this post in threaded view
|

RE: DateAndTime, Duration, and TimeZoneInfo

Boris Popov, DeepCove Labs (SNN)
Have you considered just porting Chronos to GemStone? It implements all
the ANSI classes AFAIK, see

http://www.chronos-st.org/

Cheers,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: James Foster [mailto:[hidden email]]
Sent: Wednesday, November 01, 2006 11:05 AM
To: VWNC Mailing List
Subject: DateAndTime, Duration, and TimeZoneInfo

At GemStone we are updating our implementation of TimeZone to better
handle the various rules for "daylight savings time," especially the USA
change for 2007. This is being done partly by reading the ZoneInfo
database used on Linux, Java, and a number of other platforms. In
conjunction with this work we are implementing the ANSI DateAndTime and
Duration classes. We note that while there are some goodies available
(most notably Chronos), most other vendors do not have these classes as
part of the base image. In order to encourage a common implementation
GemStone is making these classes available under the MIT license and
porting them to a couple other dialects (VW and Dolphin; VA Smalltalk
has the ANSI classes, and we have an Application with TimeZoneInfo
available).

 

A preliminary version is available for VW in the Cincom Public Store as
DateAndTime. If you are interested in the implementation for Dolphin,
VA, or GS/S, please contact me. Comments, suggestions, additions, and
fixes are welcome.

 

[hidden email]

 

Reply | Threaded
Open this post in threaded view
|

RE: DateAndTime, Duration, and TimeZoneInfo

Boris Popov, DeepCove Labs (SNN)
Sigh, nevermind the link, I see you'd mentioned it in your email. But
still, I'm curious why one couldn't just use that and port it to VA?

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: Boris Popov [mailto:[hidden email]]
Sent: Wednesday, November 01, 2006 11:08 AM
To: [hidden email]; VWNC Mailing List
Subject: RE: DateAndTime, Duration, and TimeZoneInfo

Have you considered just porting Chronos to GemStone? It implements all
the ANSI classes AFAIK, see

http://www.chronos-st.org/

Cheers,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: James Foster [mailto:[hidden email]]
Sent: Wednesday, November 01, 2006 11:05 AM
To: VWNC Mailing List
Subject: DateAndTime, Duration, and TimeZoneInfo

At GemStone we are updating our implementation of TimeZone to better
handle the various rules for "daylight savings time," especially the USA
change for 2007. This is being done partly by reading the ZoneInfo
database used on Linux, Java, and a number of other platforms. In
conjunction with this work we are implementing the ANSI DateAndTime and
Duration classes. We note that while there are some goodies available
(most notably Chronos), most other vendors do not have these classes as
part of the base image. In order to encourage a common implementation
GemStone is making these classes available under the MIT license and
porting them to a couple other dialects (VW and Dolphin; VA Smalltalk
has the ANSI classes, and we have an Application with TimeZoneInfo
available).

 

A preliminary version is available for VW in the Cincom Public Store as
DateAndTime. If you are interested in the implementation for Dolphin,
VA, or GS/S, please contact me. Comments, suggestions, additions, and
fixes are welcome.

 

[hidden email]

 

Reply | Threaded
Open this post in threaded view
|

RE: DateAndTime, Duration, and TimeZoneInfo

James Foster-3
I did look at Chronos and was very impressed with its comprehensive coverage
of all things time-related. Before I could complete a more thorough
investigation I got overwhelmed with the size (~200 classes) and wasn't sure
how well it could be broken into smaller pieces. The comment on the
"Chronos-TimeZones" said that it should not be loaded by itself and the
process of porting seemed to be more than was needed for the immediate issue
(TimeZone). Finally, after loading the whole bundle, the instructions in the
transcript for how to set the time zone resulted in an error
(ChronosTimezone not recognized as a global). I'm sure that problem can be
fixed, but overall it left me thinking that the amount of work would be less
if I started somewhere else (there are other goodies available that cover
some of the same territory). In fact, some of the code is based on David
Lewis's TimeZone package for Squeak from 1999. It became a question of
standing on the shoulders of which giants, and some are easier to climb on
that others.

James

-----Original Message-----
From: Boris Popov [mailto:[hidden email]]
Sent: Wednesday, November 01, 2006 11:27 AM
To: [hidden email]; VWNC Mailing List
Subject: RE: DateAndTime, Duration, and TimeZoneInfo

Sigh, nevermind the link, I see you'd mentioned it in your email. But
still, I'm curious why one couldn't just use that and port it to VA?

-Boris

 

Reply | Threaded
Open this post in threaded view
|

RE: DateAndTime, Duration, and TimeZoneInfo

sourcery
James Foster-3 wrote
I did look at Chronos and was very impressed with its comprehensive coverage
of all things time-related. Before I could complete a more thorough
investigation I got overwhelmed with the size (~200 classes) and wasn't sure
how well it could be broken into smaller pieces. The comment on the
"Chronos-TimeZones" said that it should not be loaded by itself and the
process of porting seemed to be more than was needed for the immediate issue
(TimeZone). Finally, after loading the whole bundle, the instructions in the
transcript for how to set the time zone resulted in an error
(ChronosTimezone not recognized as a global). I'm sure that problem can be
fixed, but overall it left me thinking that the amount of work would be less
if I started somewhere else (there are other goodies available that cover
some of the same territory). In fact, some of the code is based on David
Lewis's TimeZone package for Squeak from 1999. It became a question of
standing on the shoulders of which giants, and some are easier to climb on
that others.

James
James,

You don't mention whether you were trying to use the VisualWorks, Dolphin or Squeak version of Chronos.  Whether any messages are put to the Transcript, and what they are, differs among the three.  In the case of VW, the Transcript message also is different for Windows and non-Windows.

Based on your description above, I assume you saw the following in the Transcript, using VW:

        (ChronosTimezone offset: (ScientificDuration hours: -7) name: 'Mountan Standard Time' commonAbbreviation: #MST) beSystem.
        (ChronosTimezone at: 'Australia/Sydney') beSystem.
        (ChronosTimezone at: 'Asia/Tokyo') beSystem.
        (ChronosTimezone at: 'Asia/Calcutta') beSystem.
        (ChronosTimezone at: 'Europe/Berlin') beSystem.
        (ChronosTimezone at: 'America/New_York') beSystem.
        (ChronosTimezone at: 'America/Los_Angeles') beSystem.

The problem wais simply that ChronosTimezone and ScientificDuration are defined in the Chronos namespace, and the Transcript, unlike a Workspace, does not search through all namespaces in order to resolve global names.  That idiosyncracy of the VW Transcript was something I overlooked.  I will modify the code so that it adds the namespace prefix (a practice I usually try to avoid.)

Also, the message only appeared because you had not followed the installation instructions, not having installed the Chronos Time Zone Repository at a location where Chronos would be able to find it. [http://www.chronos-st.org/Installation.html]. In spite of that, Chronos should still have been largely functional, although not able to use any predefined Olson time zone rulesets.  The time zone repository can be installed (or reinstalled) at any time, before or after loading Chronos into your image.  

As for the number of classes, there are currently 160 classes in the VW Chronos package.  The Chronos-Utiilities package has an additional 63 classes, but it should  not normally be loaded into your image (it contains the Chronos Time Zone Compiler, and you don't need it unless you want to compile the Olson source files yourself.) Only a handful of those classes need to be considered when porting (as mentioned in the Chronos porting instructions: http://www.chronos-st.org/Porting.html].)

If you'd be interested in having Chronos ported to Gemstone, let me know.

--Alan
Reply | Threaded
Open this post in threaded view
|

[7.4.1]Problem with fonts

Carl Gundel
In reply to this post by James Foster-3
If I try to evaluate the following in VW 7.4.1 if get a Subscript out of
bounds error.  It works fine for me on VW 7.4.

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com

| theFont |
theFont := FontDescription new name: 'courier new*'.
theFont pixelSize: 16.
Screen default defaultFontPolicy findFont: theFont

Unhandled exception: Subscript out of bounds:
OrderedCollection(Object)>>subscriptBoundsErrorFor:index:
OrderedCollection>>at:
MSWindowsFont class>>createFont:toResemble:on:
FontPolicy>>findFont:
UndefinedObject>>unboundMethod
UndefinedObject(Object)>>performMethod:arguments:
UndefinedObject(Object)>>performMethod:
TextEditorController(ParagraphEditor)>>evaluateCompiled:
optimized [] in ParagraphEditor>>evaluateSelection
BlockClosure>>ensure:
Cursor>>showWhile:
TextEditorController(ParagraphEditor)>>evaluateSelection
optimized [] in ParagraphEditor>>doIt
BlockClosure>>on:do:
TextEditorController(ParagraphEditor)>>doIt
WorkspacePage>>doIt
Workbook(AbstractWorkspace)>>smalltalkDoIt
WinXPMenuBarButtonController(MenuBarButtonController)>>dispatchMenuSymbol:
WinXPMenuBarButtonController(MenuBarButtonController)>>dispatchMenuSelection:
optimized [] in [] in
MenuBarButtonView>>processShortcutKeyEventAsMenuItemAccessor:
BlockClosure>>ensure:
optimized [] in
MenuBarButtonView>>processShortcutKeyEventAsMenuItemAccessor:
BlockClosure>>on:do:
WinXPMenuBarButtonView(MenuBarButtonView)>>processShortcutKeyEventAsMenuItemAccessor:
[] in WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
OrderedCollection>>do:
WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
KeyboardProcessor>>processShortcutKeyEvent:
KeyboardProcessor>>processKeyboardEvent:
KeyboardProcessor>>processKeyboardEvent:for:
EventDispatcher>>dispatchEvent:
KeyPressedEvent(Event)>>dispatch
KeyPressedEvent(Event)>>dispatchForWindowManager:
optimized [] in WindowManager>>safelyDispatchForWindowManager:
BlockClosure>>on:do:
WindowManager>>safelyDispatchForWindowManager:
WindowManager>>processNextEvent
optimized [] in [] in WindowManager>>newProcess
BlockClosure>>on:do:
optimized [] in WindowManager>>newProcess
BlockClosure>>on:do:
optimized [] in Process class>>forBlock:priority:

----------------------------------------------------------------------
OrderedCollection(Object)>>subscriptBoundsErrorFor:index:
Receiver:
 an OrderedCollection
Instance Variables:
 firstIndex = 1
 lastIndex = 1
Arguments:
 selector = #at:
 index = 3
Context PC = 9

----------------------------------------------------------------------
OrderedCollection>>at:
Receiver:
 an OrderedCollection
Instance Variables:
 firstIndex = 1
 lastIndex = 1
Arguments:
 anInteger = 3
Context PC = 30

----------------------------------------------------------------------
MSWindowsFont class>>createFont:toResemble:on:
Receiver:
 a MSWindowsFont class
Instance Variables:
 superclass = ScreenFont
 methodDict = a MethodDictionary[4]
 format = 16392
 subclasses = an Array[1]
 instanceVariables = nil
 organization = ('converting' #withStrikeout #withUnderline)
('testing' #specifiesNativeStrikeout #specifiesNativeUnderline)

 name = #MSWindowsFont
 classPool = a NameSpaceOfClass[4]
 environment = a NameSpace[153]
Arguments:
 concreteFontDescription = a FontDescription
 requestedFontDescription = a FontDescription
 aScreen = a Screen
Temporaries:
 synthetic = true
 fName = nil
 fd = a FontDescription
 divider = $~ "16r007E"
 oneString = '1~'
 zeroString = '0~'
 stream = nil
 size = 16
 boldValue = nil
 isItalic = nil
Context PC = 108

----------------------------------------------------------------------
FontPolicy>>findFont:
Receiver:
 a FontPolicy
Instance Variables:
 availableFonts = an OrderedCollection[759]
 device = a Screen
 fontClass = MSWindowsFont
 defaultFont = a MSWindowsFont
 fontCache = a Dictionary[98]
 tolerance = 9
 nameWeight = 10
 familyWeight = 5
 manufacturerWeight = 1
 encodingWeight = 10
 pixelSizeWeight = 3
 boldnessWeight = 2
 italicWeight = 2
 serifWeight = 1
 fixedWidthWeight = 3
 setWidthWeight = 1
 verticalWeight = 10
 fdCache = a FontDescription
 dfCache = a MSWindowsFont
 noFontBlock = nil
Arguments:
 aFontDescription = a FontDescription
Temporaries:
 font = nil
 bestMatch = a FontDescription
Context PC = 54



Reply | Threaded
Open this post in threaded view
|

RE: [7.4.1]Problem with fonts

Boris Popov, DeepCove Labs (SNN)
Shouldn't it be family not name?

Screen default defaultFontPolicy
        findFont:
                ((FontDescription new)
                        family: 'courier new*';
                        pixelSize: 16;
                        yourself)

...

'courier new~16~400~0~0~0~ansi~0'

Hope this helps,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: Carl Gundel [mailto:[hidden email]]
Sent: Friday, January 26, 2007 1:27 PM
To: 'VWNC Mailing List'
Subject: [7.4.1]Problem with fonts

If I try to evaluate the following in VW 7.4.1 if get a Subscript out of

bounds error.  It works fine for me on VW 7.4.

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com

| theFont |
theFont := FontDescription new name: 'courier new*'.
theFont pixelSize: 16.
Screen default defaultFontPolicy findFont: theFont

Unhandled exception: Subscript out of bounds:
OrderedCollection(Object)>>subscriptBoundsErrorFor:index:
OrderedCollection>>at:
MSWindowsFont class>>createFont:toResemble:on:
FontPolicy>>findFont:
UndefinedObject>>unboundMethod
UndefinedObject(Object)>>performMethod:arguments:
UndefinedObject(Object)>>performMethod:
TextEditorController(ParagraphEditor)>>evaluateCompiled:
optimized [] in ParagraphEditor>>evaluateSelection
BlockClosure>>ensure:
Cursor>>showWhile:
TextEditorController(ParagraphEditor)>>evaluateSelection
optimized [] in ParagraphEditor>>doIt
BlockClosure>>on:do:
TextEditorController(ParagraphEditor)>>doIt
WorkspacePage>>doIt
Workbook(AbstractWorkspace)>>smalltalkDoIt
WinXPMenuBarButtonController(MenuBarButtonController)>>dispatchMenuSymbo
l:
WinXPMenuBarButtonController(MenuBarButtonController)>>dispatchMenuSelec
tion:
optimized [] in [] in
MenuBarButtonView>>processShortcutKeyEventAsMenuItemAccessor:
BlockClosure>>ensure:
optimized [] in
MenuBarButtonView>>processShortcutKeyEventAsMenuItemAccessor:
BlockClosure>>on:do:
WinXPMenuBarButtonView(MenuBarButtonView)>>processShortcutKeyEventAsMenu
ItemAccessor:
[] in WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
OrderedCollection>>do:
WinXPMenuBar(MenuBar)>>processShortcutKeyEventInMenuBar:
KeyboardProcessor>>processShortcutKeyEvent:
KeyboardProcessor>>processKeyboardEvent:
KeyboardProcessor>>processKeyboardEvent:for:
EventDispatcher>>dispatchEvent:
KeyPressedEvent(Event)>>dispatch
KeyPressedEvent(Event)>>dispatchForWindowManager:
optimized [] in WindowManager>>safelyDispatchForWindowManager:
BlockClosure>>on:do:
WindowManager>>safelyDispatchForWindowManager:
WindowManager>>processNextEvent
optimized [] in [] in WindowManager>>newProcess
BlockClosure>>on:do:
optimized [] in WindowManager>>newProcess
BlockClosure>>on:do:
optimized [] in Process class>>forBlock:priority:

----------------------------------------------------------------------
OrderedCollection(Object)>>subscriptBoundsErrorFor:index:
Receiver:
 an OrderedCollection
Instance Variables:
 firstIndex = 1
 lastIndex = 1
Arguments:
 selector = #at:
 index = 3
Context PC = 9

----------------------------------------------------------------------
OrderedCollection>>at:
Receiver:
 an OrderedCollection
Instance Variables:
 firstIndex = 1
 lastIndex = 1
Arguments:
 anInteger = 3
Context PC = 30

----------------------------------------------------------------------
MSWindowsFont class>>createFont:toResemble:on:
Receiver:
 a MSWindowsFont class
Instance Variables:
 superclass = ScreenFont
 methodDict = a MethodDictionary[4]
 format = 16392
 subclasses = an Array[1]
 instanceVariables = nil
 organization = ('converting' #withStrikeout #withUnderline)
('testing' #specifiesNativeStrikeout #specifiesNativeUnderline)

 name = #MSWindowsFont
 classPool = a NameSpaceOfClass[4]
 environment = a NameSpace[153]
Arguments:
 concreteFontDescription = a FontDescription
 requestedFontDescription = a FontDescription
 aScreen = a Screen
Temporaries:
 synthetic = true
 fName = nil
 fd = a FontDescription
 divider = $~ "16r007E"
 oneString = '1~'
 zeroString = '0~'
 stream = nil
 size = 16
 boldValue = nil
 isItalic = nil
Context PC = 108

----------------------------------------------------------------------
FontPolicy>>findFont:
Receiver:
 a FontPolicy
Instance Variables:
 availableFonts = an OrderedCollection[759]
 device = a Screen
 fontClass = MSWindowsFont
 defaultFont = a MSWindowsFont
 fontCache = a Dictionary[98]
 tolerance = 9
 nameWeight = 10
 familyWeight = 5
 manufacturerWeight = 1
 encodingWeight = 10
 pixelSizeWeight = 3
 boldnessWeight = 2
 italicWeight = 2
 serifWeight = 1
 fixedWidthWeight = 3
 setWidthWeight = 1
 verticalWeight = 10
 fdCache = a FontDescription
 dfCache = a MSWindowsFont
 noFontBlock = nil
Arguments:
 aFontDescription = a FontDescription
Temporaries:
 font = nil
 bestMatch = a FontDescription
Context PC = 54