[phobos] next release

Steve Schveighoffer schveiguy at yahoo.com
Fri Sep 17 10:50:10 PDT 2010





----- Original Message ----
> From: Walter Bright <walter at digitalmars.com>
> To: Discuss the phobos library for D <phobos at puremagic.com>
> Sent: Thu, September 16, 2010 10:38:56 PM
> Subject: Re: [phobos] next release
> 
> 
> 
> Sean Kelly wrote:
> >
> > There are a bunch of routines in  druntime that could really use a structured 
>timespan representation (Boost  actually even uses a full SystemTime class for 
>most of these) and I'm trying to  work out the best way to do this.  In Tango, 
>the decision was to have the  routines all accept a long value that is the same 
>resolution as the tick count  from TimeSpan, which is why everything currently 
>works as it does.  I've  always hated this and would love to do something more 
>structured, but  complications arise from possible redundancy or incompatibility 
>with  std.time.  What I've done for now is duplicate Boost's time_duration 
>struct  (as TimeDuration) into core.time, and I'm looking at using this for  
>Thread.sleep(), etc.  Thoughts?
> >
> >  
> 
> I thought  Tango used a floating point representation of time? (BTW, I 
> think such a  representation is a mistake for various  reasons.)

This was my main problem with Tango's time functions when I first proposed the 
changes I eventually made for Tango.  So yes, it did use this at one point, but 
no longer does (since about 3 years ago?).   See this thread (no Tango code 
involved, just samples): http://www.dsource.org/projects/tango/forums/topic/205

Using floating point is actually not that bad, you just need to add a proper 
epsilon when converting.  But since most core functions use an integral time 
representation, converting from one integer into another is faster.

In response to Sean, I think the time span type can live in core, even if it's 
used in std.time.  std.datetime can easily just public include core.time.  In 
fact, I think I at one point had Tango set up this way (with all the 
time-related core functions taking a TimeSpan), but Kris rejected it.

-Steve



      


More information about the phobos mailing list