Friday, May 30, 2008

load document start marker & timestamp

Still working on adding load_spec test, try to fix some bugs during the test process.
1. RbYAML should load "---" as a string, but not a document start marker. The document start marker should be "---\n", "---\t", "--- "(there is a blank after dash), etc.
RbYAML.load("---") => "---"


2. When load timestamp, should parse fraction of a second correctly.
Previously, "2001-12-15T02:59:43.1Z" will be loaded as an Time instance which the microsecond is 1000.
In my opinion, it should be 1e5 microsecond.(1 second equals to 1e6 microsecond)
another thing is if the digit number of fraction part is more than 6, it should parse as a round number. For example,
When "2001-12-15T02:59:43.1234567890000Z", the microsecond should be 123457.

Following is about CRuby.
1. In Syck(CRuby YAML), it will be loaded as 1234567890000 microsecond. then transform to corresponding second, minutes, hours...
Here it will be Sat Dec 15 03:35:30 UTC 2001, and the microsecond is 483647.
2. Time class. As a Time instance, the to_s and inspect method will only accurate to second. You should call usec method to get the microsecond. It might be a bit confusion when you compare two Time instances.

No comments: