Re: D2 phobos std.date question
Stewart Gordon Wrote: > Sam Hu wrote: > > Which method/ how can I produce proper result of local datetime? > > getUTCtime,UTCtoLocalTime,localTimeToUTC all can not produce the proper > > result. > > > > Could any body help?Thanks. > > Not without seeing your code and knowing what exactly you're trying to do. > > Stewart. Thank you so much for your attention.Actually my questions are: 1.std.date has no implementation on getting local region system time,is this true?Say getUTCtime(),UTCtoLocalTime() are all 8 hours behind my region;I remembered in Tango this is not a problem.gtkD provide a clock demo which I have build both under D1+tango and D2,2 exe show different time.The tango one is correct. 2.If I want to get proper system time under D2,I need do by myself,either +8hours hard-codes or call system API by myself,is this the only choice? Thanks and best regards, Sam
Re: formatting floating point
>>> You'd just have to convert each element of the >>> array separately. >> >> I found the formatting options, they are in std.format.. >> (I was apparently searching for the 'g' option.. ) >> >> this seems to work (using std2.string.format) >> >> double[] d1; >> d1=[double.max,double.min]; >> char[] c; >> c=format( "%.100g",d1); //100 is enough for reals I think? >> writefln(c); >> //[1.7976931348623157079e+308,2.2250738585072013832e-308] > double.dig, real.dig gives you the number of meaningful decimal digits. Ah, I see, thanks. But choosing an insane big number of precision in combination with g seems to work perfectly already. Although there probably is a better formatting option, I hope.
Re: D2 phobos std.date question
Sam Hu wrote: Which method/ how can I produce proper result of local datetime? getUTCtime,UTCtoLocalTime,localTimeToUTC all can not produce the proper result. Could any body help?Thanks. Not without seeing your code and knowing what exactly you're trying to do. Stewart.
Re: formatting floating point
Saaa wrote: Ohh, I see. Your initial question was really vague, now that I see what you were asking. sorry You'd just have to convert each element of the array separately. I found the formatting options, they are in std.format.. (I was apparently searching for the 'g' option.. ) this seems to work (using std2.string.format) double[] d1; d1=[double.max,double.min]; char[] c; c=format( "%.100g",d1); //100 is enough for reals I think? writefln(c); //[1.7976931348623157079e+308,2.2250738585072013832e-308] double.dig, real.dig gives you the number of meaningful decimal digits.
Re: Release binary
Vladimir Voinkov wrote: I've noticed that constant strings are still presented in release bynary: static invariant string Abc0 = "abcdefg"; static const string Abc1 = "abcdefg"; A source compiles with -O -release and the strings are not referenced. Is linked able to optimize them out? No, the DMD linker isn't smart enough. (Maybe the LDC one is?) BTW that's why D2 has 'enum' for manifest constants. It's a language hack to work around a linker limitation.
Re: ulong divides (by) int cause dmd crash
http://d.puremagic.com/issues/show_bug.cgi?id=3169