I made std.time for Phobos, please review my code.

SHOO zan77137 at nifty.com
Tue Apr 27 09:32:44 PDT 2010


Steven Schveighoffer さんは書きました:
> On Tue, 27 Apr 2010 04:55:28 -0400, SHOO <zan77137 at nifty.com> wrote:
> 
>> Tango is great library for D1. I am Tango user and I am indebted to
>> Tango well. But Tango has some probrems.
>>
>> - Tango's license is BSD lisence or AFL. This license is incompatible to
>> Phobos's Boost license.
>> - The specification is disregarded, for example Object.dispose and 
>> string.
>> - Tango supports only D1
>> - In particular, deep regret is to have split resources of D into two
>> halves.
>>
>> If possible, I want to migrate to D2. And I want to be separated from
>> Tango. However, some functions are insufficient for Phobos compared with
>> Tango.
>> The std.date module is one of the list of dissatisfaction to Phobos.
>> I summarize my (and some of Japanese users's) opinion following:
>>
>> - I want to handle it as another thing for the time and the time span.
>> - I want a more structural class for time operating.
>> - std.date is a bit buggy...
>>
>> By these reasons, I made std.time module as the first step of the
>> contribution for Phobos.
> 
> I like what you've done.  It's very similar to what was done in Tango.  
> I hate to ask this, but I just want to verify that you did not base your 
> code on Tango, especially since you have used Tango.  I was planning to 
> implement a Time system for Tango that mimics Tango's design, if that is 
> what you have done, I think that's perfectly legit.  Basically, I want 
> to verify that you rewrote all your implementation from scratch.

I wrote it by own hand.
But I referred to Tango, Phobos or some web site some interfaces and 
physical quantities(The thing which becomes the same quantity even if 
anyone calculates).

Please point out the point where you noticed.

> More comments:
> 
> I'd like accessors for seconds/milliseconds/etc from Span.

For integer?
I dislike that precision is cut off.
You can get seconds with a real number in interval, or calculate by 
ticks and TICKSPERSEC.

> I'm not sure I like the Clocks structure.  Why have a separate Span that 
> is in terms of some arbitrary OS resolution?  Can you give an example of 
> why I'd want to use Clocks instead of Span?
> 
> -Steve

Clocks.TICKSPERSEC may have better precision than Span.TICKSPERSEC.
Sacrificing precision in the middle of a calculation is MOTTAINAI.
Clocks may be used for benchmarks or exact time measurement.


More information about the Digitalmars-d-announce mailing list