VASmalltalk – SystemTimeOffset again …

As you may know from the past I had published solutions to these DataAndTime>>primitiveSystemOffset error.

Due to the fact, that this might be changed in the 8.5.2 release – but I have daylight-saving-time setting now – I changed MSKPlatformExtension to include corrected methods for Windows and Linux. With 1.24 or MSKPlatformExtension this patch is included – for both operating systems in different supapplication (to make headless packaging possible – without warnings).

To make this patch active, you have to patch your Kernel application (where DateAndTime is defined):

Copy #primitiveSystemOffset method to #primitivePrimitiveSystemOffset (which is therefore a copy of the original one):

and …

primitiveSystemOffset
  "Answer an  representing the westward displacement of system local time
   from UTC in seconds.  The value can be betwen 0 and 86400 minutes."

  | aClass |
	
  ^(aClass := Smalltalk at: #MSKOperatingServices ifAbsent:[ nil ]) isNil 
    ifTrue:[  self primitivePrimitiveSystemOffset ]
    ifFalse:[ aClass MSKPrimitiveSystemOffset ]

Then you should get a corrected offset, if application MSKPlatformExtension has been loaded – otherwise you get the product (wrong) behaviour.

By the way: one could produce a patch for this problem by using ICU – delivering a solution for all supported platform. A platform independent solutions for the original primitiveSystemOffset could also be (using ICU):

^(0 - MSKLocale current offsetFromUTC asSeconds)

Which patch is a more suitable one ? The first one is a more product oriented one – just patching the error, the ICU oriented one is one I have used in my 8.5.0 Kernel – because I simply added ICU very near to the Kernel – more or less on the same level. Because UTF8, timezones and all that stuff is pretty low level and affects lots of other subsystems also.

Advertisement
This entry was posted in Smalltalk and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.