www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.date / std.datetime

reply Richard Chamberlain <richard sunsetandlabrea.com> writes:
Hello,

I'm in the process of learning D, and to do so I'm converting some older code.

I need to print out the current local date and time, which is causing 
some difficulties because std.date doesn't seem adequate in this 
respect. I understand there is soon to be a replacement, std.datetime, 
which I suspect will be much easier.

When are we likely to see a new release which includes std.datetime?

If not relatively soon I presume the easiest thing to do is to download 
it myself and recompile the phobos library to include it. In which case 
there seems to be already a std.datetime with different functionality, 
is this used elsewhere in phobos? i.e. if I replace it with the new 
std.datetime is that OK?

Many thanks,

Richard
Jan 18 2011
next sibling parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Tuesday 18 January 2011 03:34:06 Richard Chamberlain wrote:
 Hello,
 
 I'm in the process of learning D, and to do so I'm converting some older
 code.
 
 I need to print out the current local date and time, which is causing
 some difficulties because std.date doesn't seem adequate in this
 respect. I understand there is soon to be a replacement, std.datetime,
 which I suspect will be much easier.
 
 When are we likely to see a new release which includes std.datetime?
 
 If not relatively soon I presume the easiest thing to do is to download
 it myself and recompile the phobos library to include it. In which case
 there seems to be already a std.datetime with different functionality,
 is this used elsewhere in phobos? i.e. if I replace it with the new
 std.datetime is that OK?

std.datetime is currently in Phobos' svn repository and will be in the next release. - Jonathan M Davis
Jan 18 2011
parent reply %fil <fil learningd.com> writes:
Hi Jonathan,

I'm also stuck with the existing std.date and would want to try out your new
module std.datetime. Do you have any sense when the next release of Phobos is
going to be?

If not, what is the procedure to get a "development snapshot" of the latest
version of Phobos installed?

thanks,

fil
Jan 18 2011
parent Richard Chamberlain <richard sunsetandlabrea.com> writes:
On 2011-01-18 16:34:53 +0000, Jonathan M Davis said:

 On Tuesday 18 January 2011 04:15:20 %fil wrote:
 Hi Jonathan,
 
 I'm also stuck with the existing std.date and would want to try out your
 new module std.datetime. Do you have any sense when the next release of
 Phobos is going to be?

I don't know. The last release was about a month ago, and the one before that was about a month and a half before that. I'm not aware of there being any hard and fast rules or plan about when releases are done. However, they tend to be a month or two apart.
 If not, what is the procedure to get a "development snapshot" of the latest
 version of Phobos installed?

The latest code can be found here: http://www.dsource.org/projects/phobos However, you're going to have to have the latest druntime as well: http://www.dsource.org/projects/druntime - Jonathan M Davis

Thanks Jonathan. I think I'll hang around for the official update.
Jan 18 2011
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Tuesday 18 January 2011 04:15:20 %fil wrote:
 Hi Jonathan,
 
 I'm also stuck with the existing std.date and would want to try out your
 new module std.datetime. Do you have any sense when the next release of
 Phobos is going to be?

I don't know. The last release was about a month ago, and the one before that was about a month and a half before that. I'm not aware of there being any hard and fast rules or plan about when releases are done. However, they tend to be a month or two apart.
 If not, what is the procedure to get a "development snapshot" of the latest
 version of Phobos installed?

The latest code can be found here: http://www.dsource.org/projects/phobos However, you're going to have to have the latest druntime as well: http://www.dsource.org/projects/druntime - Jonathan M Davis
Jan 18 2011
prev sibling next sibling parent Russel Winder <russel russel.org.uk> writes:
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, 2011-01-18 at 08:34 -0800, Jonathan M Davis wrote:
[ . . . ]
 I don't know. The last release was about a month ago, and the one before =

 was about a month and a half before that. I'm not aware of there being an=

 and fast rules or plan about when releases are done. However, they tend t=

 month or two apart.

 The latest code can be found here: http://www.dsource.org/projects/phobos
=20
 However, you're going to have to have the latest druntime as well: =20
 http://www.dsource.org/projects/druntime

Might it be worth putting in some infrastructure whereby people can use a distributed DMD or GDC but have a current snapshot or perhaps latest build of Phobos (where there is consistency between DMD/GDC on the one hand and Phobos on the other). This is actually one thing Go does supremely well, you can pull the Mercurial snapshot and build the entire system within about 5 minutes. It makes it very easy to test new stuff.=20 --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Jan 18 2011
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Tuesday, January 18, 2011 09:18:33 Russel Winder wrote:
 On Tue, 2011-01-18 at 08:34 -0800, Jonathan M Davis wrote:
 [ . . . ]
 
 I don't know. The last release was about a month ago, and the one before
 that was about a month and a half before that. I'm not aware of there
 being any hard and fast rules or plan about when releases are done.
 However, they tend to be a month or two apart.

[ . . . ]
 The latest code can be found here: http://www.dsource.org/projects/phobos
 
 However, you're going to have to have the latest druntime as well:
 http://www.dsource.org/projects/druntime

Might it be worth putting in some infrastructure whereby people can use a distributed DMD or GDC but have a current snapshot or perhaps latest build of Phobos (where there is consistency between DMD/GDC on the one hand and Phobos on the other). This is actually one thing Go does supremely well, you can pull the Mercurial snapshot and build the entire system within about 5 minutes. It makes it very easy to test new stuff.

There has been discussion of D needing some sort of package management system. Perhaps that would deal with that issue. And maybe with dmd, druntime, and Phobos being moved over to git and github (which is currently being worked on) will make that easier. I don't know. However, I think that the focus of the dev team overall has been more on getting done than making it easier for people to get current development snapshots or know exactly what's going on with development at the moment. That's not to say that such things shouldn't be improved or that the dev team doesn't want to improve them, but there have been other priorities which have taken precedence. There's also a strong tendency for things to get done because someone wants them done and takes the time to do them, and if there's no one who's motivated enough to do something, then it often doesn't get done in a timely manner. - Jonathan M Davis
Jan 18 2011
prev sibling parent torhu <no spam.invalid> writes:
On 18.01.2011 12:34, Richard Chamberlain wrote:
 Hello,

 I'm in the process of learning D, and to do so I'm converting some older code.

 I need to print out the current local date and time, which is causing
 some difficulties because std.date doesn't seem adequate in this
 respect. I understand there is soon to be a replacement, std.datetime,
 which I suspect will be much easier.

 When are we likely to see a new release which includes std.datetime?

 If not relatively soon I presume the easiest thing to do is to download
 it myself and recompile the phobos library to include it. In which case
 there seems to be already a std.datetime with different functionality,
 is this used elsewhere in phobos? i.e. if I replace it with the new
 std.datetime is that OK?

You could always use the C functions, if you import core.stdc.time. The ctime and strftime functions should do the trick. http://cplusplus.com/reference/clibrary/ctime/
Jan 18 2011