[Ironruby-core] Code Review: Time7

Tomas Matousek Tomas.Matousek at microsoft.com
Sun Nov 29 23:37:18 EST 2009


  tfpt review "/shelveset:Time7;REDMOND\tomat"
  Comment  : 
  
  Adds NoUnderlyingType to ModuleRestrictions. 
  -	If set, the members of the underlying CLR type are not accessible from Ruby (not even via clr_new, etc.) 
  -	A Ruby library class/module can either extend an existing CLR type or be self-contained.  A self-contained class/module has ModuleRestriction.NoUnderlyingType set by default.
  
  Separates Ruby method implementations on RubyTime to a separate class so that we can expose RubyTime underlying CLR type.
  
  Fixes bugs and Time related specs:
  http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2912
  http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2217
  
  Time zones
  It seems that MRI is using CRT zone API (_tzset) on Windows. That API (http://msdn.microsoft.com/en-us/library/90s5c885(VS.80).aspx) is buggy and also different from Unix API based on TZ environment variable. The only thing _tzset does is that it parses TZ environment variable value using format <time-zone-name>< zone offset hh:mm:ss> and stores the parsed values into global variables. It doesn't look up time zone name in any database (registry) or even allow to specify DST offset and rule (unlike POSIX TZ variable). As a consequence MRI on Windows doesn't correctly implement daylight saving related API (Time#dst?). If the offset is not specified in TZ variable we don't know anything about the zone and thus no zone related methods work correctly. And indeed the specs are failing. Besides, MRI doesn't update the current time zone if TZ environment variable is changed at runtime (it only parses it once when the process is initialized) - http://redmine.ruby-lang.org/issues/show/1972.
  
  This change makes IronRuby recognize TZ environment variable and update the current time zone whenever ENV["TZ"] is assigned to. Current limitations:
  1)	TZ variable needs to define zone offset. We don't do time zone name lookup and so only time zone name or abbreviation is not sufficient. If the offset is not specified we use the default time zone provided by OS and report a warning.
  2)	Time#dst? always uses the default OS zone, not the one that is specified by TZ variable. A warning is reported if the current zone comes from TZ variable. 
  
  Fixes Time specs that were relying on Unix specific commands.
  
  Fixes time related bugs in YAML and a bug in the YAML scanner:
  http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2044
  
  Enables subclassing socket classes, fixes:
  http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3196
  
  There is a also bug in tzinfo gem:
  C:\M0\Merlin\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p368\lib\ruby\gems\1.8\gems\tzinfo-0.3.15\lib\tzinfo\time_or_datetime.rb
  Line #43 is missing usec parameter:
  @time = Time.utc(@time.year, @time.mon, @time.mday, @time.hour, @time.min, @time.sec, @time.usec) unless @time.zone == 'UTC'        

Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Time7.diff
Type: application/octet-stream
Size: 337797 bytes
Desc: Time7.diff
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091130/0218bb78/attachment-0001.obj>


More information about the Ironruby-core mailing list