Very, very preliminary port of Chronos to Squeak published to SqueakMap

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

Very, very preliminary port of Chronos to Squeak published to SqueakMap

Alan L. Lovejoy
Avi Bryant is currently working on a port of Chronos to Squeak. He has published a Monticello package to SqueakMap that contains a very preliminary port.  It is very much a "work in progress." When Avi is satisfied that the port is sufficiently functional and stable, he will make a general announcement to that effect.  No promises have been made with respect to when a version suitable for general use may become available, nor is there any commitment to provide all the same functionality as is available from the VisualWorks version. Of course, nothing prevents others from contributing improvements/enhancements in addition to whatever Avi publishes.
 
Initially, Avi does not plan to port the Chronos Time Zone Compiler to Squeak.  Tthe Chronos Time Zone Compiler is used to generate the Chronos Time Zone Repository from the information provided by the Olson Time Zone Database. Since the Chronos Time Zone Repository a) is available from the Chronos web site, and b) is usable "as is" by any Smalltalk implementation (in fact, it would be usable by any programming language, given a sufficiently powerful time zone implementation written in that language,)  that's not that big of an issue.
 
It's only recently that I have become at all familiar with Avi's work.  Initially, I only knew he was one of the principal authors of Seaside.  But he's done much more than just that (although Seaside is impressive enough by itself.)
 
I am very appreciative of the contributution Avi is making towards porting Chronos to Squeak.
 
Fair warning: As of Sat, 25 Feb 2006 03:31:56 +0000 (Universal Time,) the version on SqueakMap will not work "as is" in versions of Squeak from 3.7 onward (you can load it, but if you execute the initialization/installation "do it" that the pop-up Transcript window suggests, you will then be unable to either save the image or compile any methods.)  The problem is caused by the fact that the installation procedure (as implemented in the version currently available from SqueakMap) redefines both DateAndTime and Duration so that they are aliases for the Chronos classes Timepoint and ScientificDuration (respectively,) in place of the native Chronology classes named DateAndTime and Duration (and this issue is precisely why I chose not to use the names "DateAndTime" and "Duration" as class names.) This problem can be fixed if, before evaluating the 'ChronosEnvironment install' "do it" as suggested, the following class method is first implemented:
 
ChronosSqueakEnvironment class>>setProtectedGlobalVariables 
    ProtectedGlobalVariables := Set with: #ScaledDecimal with: #DateAndTime with: #Duration.
 
Avi is using Squeak 3.6 to do the porting work.  The Chronology library did not become part of standard Squeak until version 3.7, and so there is no issue raised by (re)defining the globals DateAndTime and Duration as global aliases for Timepoint and ScientificDuration (respectively) in versions of Squeak prior to 3.7.  That may well be why Avi is using Squeak 3.6 to do the port. (Squeak badly needs a mechanism to more elegantly handle issues such as this one.)
 
Note that the version currently available from SqueakMap has not been given the ability to access files--so it can't retrieve any time zones from the Chronos Time Zone Repository, and therefore Olson time zone keys such as 'Americal/Los_Angeles', 'Europe/Paris' and 'Asia/Tokyo' cannot be used to identify a time zone. Nor is there any code that makes any attempt to determine the local time zone from the host operating system, nor any code that provides any locale information. 
 
Consequently, the Chronos system time zone simply defaults to Universal Time (which is what the native Chronology library does also, so at least you're no worse off than you were before.)  Nevertheless, you can still do quite a bit. For example, after loading and properly initializing Chronos, you can evaluate the following expression to set the Chronos system time zone so that it matches the zone rules that have been in effect since 1996 for CET/CEST (Central European Time):
 
    (ChronosTimezone
        key: #'Europe/Berlin' name: #'Central European Time'
        initialOffset: (ScientificDuration hours: 1) withAbbreviation: #CET 
            until: (WeekOfMonthDayOfWeek month: 3 week: 0 dayOfWeek: 1) "The 'zeroeth week' means the last week of the month"
            at: (TimeOfDay hour: 1 minute: 0 second: 0) relativity: #universal
        thenOffset: (ScientificDuration hours: 2)  withAbbreviation: #CEST  
            until: (WeekOfMonthDayOfWeek month: 10 week: 0 dayOfWeek: 1)
            at: (TimeOfDay hour: 1 minute: 0 second: 0) relativity: #universal)
                beSystem
 
Then, you can evaluate "Timepoint now" to see the current time. And if you find yourself in Madrid, Paris, Berlin or Amsterdam, the answer will even be correct.  However, due to the fact that the Squeak system clock reports local time, setting the Chronos system time zone has no effect on what is displayed when "Timepoint now" is evaluated.  It only changes the results of evaluating "Timepoint utNow."   On a system whose clock reported Universal Time, the situation would be reversed.
 
--Alan
 
 


Reply | Threaded
Open this post in threaded view
|

Re: Very, very preliminary port of Chronos to Squeak published to SqueakMap

Avi  Bryant

On Feb 24, 2006, at 10:09 PM, Alan Lovejoy wrote:

> Avi Bryant is currently working on a port of Chronos to Squeak. He  
> has published a Monticello package to SqueakMap that contains a  
> very preliminary port.  It is very much a "work in progress." When  
> Avi is satisfied that the port is sufficiently functional and  
> stable, he will make a general announcement to that effect.  No  
> promises have been made with respect to when a version suitable for  
> general use may become available, nor is there any commitment to  
> provide all the same functionality as is available from the  
> VisualWorks version. Of course, nothing prevents others from  
> contributing improvements/enhancements in addition to whatever Avi  
> publishes.
>

Alan, thanks for the detailed post, it saves me from having to write  
one.  Yes, for now I've only done a very preliminary port, but I do  
intend to keep working on it as time permits.  It's actually quite a  
testament to how portably Chronos was written that as much works as  
it does given the small amount of effort and code that I put in.  If  
anyone would like to help flesh the port out, let me know.

Avi

Reply | Threaded
Open this post in threaded view
|

Re: Very, very preliminary port of Chronos to Squeak published to SqueakMap

David T. Lewis
In reply to this post by Alan L. Lovejoy
On Fri, Feb 24, 2006 at 10:09:34PM -0800, Alan Lovejoy wrote:
>  
> Initially, Avi does not plan to port the Chronos Time Zone Compiler to
> Squeak.  Tthe Chronos Time Zone Compiler is used to generate the Chronos
> Time Zone  <http://www.chronos-st.org/downloads/time-zones.zip> Repository
> from the information provided by the Olson Time Zone Database
> <http://www.twinsun.com/tz/tz-link.htm> .

Note that TimeZoneDatabase (on Squeak Map) provides a complete
implementation of this in Squeak.

Dave