April 27, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | On Tue, 27 Apr 2010 13:26:25 -0400, SHOO <zan77137@nifty.com> wrote:
> Michel Fortin さんは書きました:
>> On 2010-04-27 04:55:28 -0400, SHOO <zan77137@nifty.com> said:
>>
>>> By these reasons, I made std.time module as the first step of the
>>> contribution for Phobos.
>> Looks nice. I think defining structs as you did to handle date and time is the way to go.
>> I've done something similar in the past to store dates and times which I like a lot. What I did was just a storage format, but templates allowed me to store dates and time spans with any precision while exposing always the same public API.
>> I'm pasting my code below in case it can inspire you (note that this code predates the new operator overloading syntax), and feel free to use any of this under the Boost license if applicable.
>
> In the code that I wrote, it can express Time until December 31, 9999. And, the precision of Span is 100 nanoseconds order.
> About the precision, I think that it is necessary and sufficient condition.
Two other benefits to using 100NS increments: Windows FILETIME structures use that same resolution, and Tango uses that same resolution. So we have easy compatibility throughout many systems, while at the same time capturing a wide enough range to last for 8000 years :)
-Steve
|
April 28, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 28/04/10 02:58, bearophile wrote:
> Steven Schveighoffer:
>> 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.
>
> In D2 the runtime of Phobos and Tango have being merged, so all D programmers can install both libs. So the two libs must have distinct contents.
> So I'm for removing the time module from Phobos, and keep only the Tango one. So this module is waste of time, and efforts have to be redirected in improving or rewriting the time module of Tango.
> Othrwise in D2 it will happen the same mess it's happend in D1, where you have two partially duplicated libs. All D2 programmers will want to install both libs, and they will not desire to choose what time lib to use. One time lit is enough.
>
> Bye,
> bearophile
I take it then, that you are offering to port Tango to D2? That's very sporting of you!
If not, then don't speak of using Tango, as it can not be used with D2 today, and SHOO's std.time can. Which makes std.time vastly more useful than Tango's classes. We need a decent date and time module for D2 right *now*, not in a speculative future.
|
April 28, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Steven Schveighoffer さんは書きました: > On Tue, 27 Apr 2010 12:32:44 -0400, SHOO <zan77137@nifty.com> wrote: > The internal storage is via integer, so if for example the integer number of milliseconds is desired, doing the calculation via converting to a floating point, and then scaling/truncating is inefficient, subject to floating point error, and more convoluted than it has to be. I'd rather have an exact method that is as fast as possible, and is as simple as possible. It is not too much extra to add these methods (they are pretty much boilerplate code). > Many existing C libraries and network protocols encode time via integers, so there is real need to be able to convert to these units, and to allow it with as little syntax as possible is good. Even if there are Span.seconds, Span.mseconds...etc., it is not strange. In addition, it give the symmetry with seconds, mseconds ...etc. I'm getting the feeling that the one that there are not the methods is strange than there are. I'll try it. > Then all that is left is the name, Clocks is not a good name for a value type entity. It seems more suited for a static entity that contains clocks. You already have defined interval, so that is out. I can't think of anything good right now, but it definitely should not be a plural word. > > This is a very solid library, very little to complain about! I have sense of incongruity for a name of Clocks. But good ideas about the name did not appear. Do you have any ideas? >ALL > One thing I would suggest if this is assimilated into druntime/phobos is that we split the Span functionality out into it's own module (or put it in object.di) so it can be used in druntime for things like Thread.sleep. It's nice. Thread.sleep confuses me a little because the argument's number of digits is too big. I hope so strongly. > -Steve |
April 28, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Steven Schveighoffer Wrote:
>
> Two other benefits to using 100NS increments: Windows FILETIME structures use that same resolution, and Tango uses that same resolution. So we have easy compatibility throughout many systems, while at the same time capturing a wide enough range to last for 8000 years :)
The core package in D2 uses that resolution as well. It would be great if this could be represented by a struct rather than a long int.
|
April 30, 2010 Re: I made std.time for Phobos, please review my code. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | "Steven Schveighoffer" <schveiguy@yahoo.com> wrote in message news:op.vbtz2wngeav7ka@localhost.localdomain... > > Then all that is left is the name, Clocks is not a good name for a value type entity. It seems more suited for a static entity that contains clocks. You already have defined interval, so that is out. I can't think of anything good right now, but it definitely should not be a plural word. > Ticks? |
May 13, 2010 I rewrite std.time for Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | SHOO $B$5$s$O=q$-$^$7$?(B: > I make std.time module for Phobos. This module provides Time, Span, > Clock, StopWatch and some utility functions for time operation. > I hope combine this module to Phobos instead of std.date. > > download is here: > http://j.mp/95aS1K (== http://dusers.dip.jp/ ... /time.d) > http://j.mp/9p5DDu (patch for Phobos's trunk r1481) > http://ideone.com/eiQ19 (for code view) > > Besides, is there the necessary function? (This module lacks the daylight saving time handling, because of a lack of my understanding.) > > > I talk about the process that reached making... > > 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. Too late to update std.time, but... My old code was represented infringing Tango's license. (See: http://www.digitalmars.com/d/archives/digitalmars/D/announce/Masahiro_Nakagawa_and_SHOO_invited_to_join_Phobos_developers_18108.html ) Therefore, I checked and rewrote some codes for excluding code that may infringe Tango. This: http://ideone.com/M2zB7 I checked it carefully. And I clarified an origin of source of all cords. (Check "Note:" tags.) I hereby made clear that this module does not include the cord which infringes Tango. The interface referred to ptime and time_duration of Boost. (I think others are rather complicating for standard library.) By this reason, I changed some names. (Span to Duration) If this contribution is turned down, I give up std.time. |
May 13, 2010 Re: I rewrite std.time for Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | (Note that SHOO means "code" where he says "cord". "Code" and "cord"
are both $B%3!<%I(B in Japanese, so it's easy for Japanese folks to get the
two words mixed up.)
--bb
2010/5/13 SHOO <zan77137@nifty.com>:
> SHOO $B$5$s$O=q$-$^$7$?(B:
>> I make std.time module for Phobos. This module provides Time, Span,
>> Clock, StopWatch and some utility functions for time operation.
>> I hope combine this module to Phobos instead of std.date.
>>
>> download is here:
>> http://j.mp/95aS1K (== http://dusers.dip.jp/ ... /time.d)
>> http://j.mp/9p5DDu (patch for Phobos's trunk r1481)
>> http://ideone.com/eiQ19 (for code view)
>>
>> Besides, is there the necessary function? (This module lacks the daylight saving time handling, because of a lack of my understanding.)
>>
>>
>> I talk about the process that reached making...
>>
>> 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.
>
> Too late to update std.time, but...
>
>
> My old code was represented infringing Tango's license.
> (See:
> http://www.digitalmars.com/d/archives/digitalmars/D/announce/Masahiro_Nakagawa_and_SHOO_invited_to_join_Phobos_developers_18108.html
> )
>
>
> Therefore, I checked and rewrote some codes for excluding code that may infringe Tango.
>
> This: http://ideone.com/M2zB7
>
> I checked it carefully. And I clarified an origin of source of all
> cords. (Check "Note:" tags.)
> I hereby made clear that this module does not include the cord which
> infringes Tango.
>
> The interface referred to ptime and time_duration of Boost. (I think
> others are rather complicating for standard library.)
> By this reason, I changed some names. (Span to Duration)
>
> If this contribution is turned down, I give up std.time.
>
|
May 13, 2010 Re: I rewrite std.time for Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | On Thu, 13 May 2010 10:42:56 -0400, SHOO <zan77137@nifty.com> wrote: > Therefore, I checked and rewrote some codes for excluding code that may > infringe Tango. I don't know if this will be enough, I wish I could tell you different. Can you identify which functions you rewrote from the original proposal to help focus Tango's attention? Is there anyone listening from Tango who can check this against Tango code to see if you still consider it to be infringing? > If this contribution is turned down, I give up std.time. First, I hope this can be included, it looks like very solid code. Second, if it cannot be included, I hope this does not dissuade you from contributing to Phobos for other modules. -Steve |
May 13, 2010 Re: I rewrite std.time for Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | Steven Schveighoffer wrote:
> First, I hope this can be included, it looks like very solid code. Second, if it cannot be included, I hope this does not dissuade you from contributing to Phobos for other modules.
Basically, the next time there's a suggestion of infringement from anyone, I'd like a specific list of the lines of source that are infringing. I don't think there's any reasonable way to deal with it otherwise. It shouldn't be necessary to guess what those lines might be.
|
May 14, 2010 Re: I rewrite std.time for Phobos | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter $B$5$s$O=q$-$^$7$?(B:
> (Note that SHOO means "code" where he says "cord". "Code" and "cord"
> are both $B%3!<%I(B in Japanese, so it's easy for Japanese folks to get the
> two words mixed up.)
>
Oops, I'm embarrassing!
And thanks for your help.
|
Copyright © 1999-2021 by the D Language Foundation