Re: what's the best way to convert a sysTime to local machine's time (zone)?

2020-09-24 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Sep 24, 2020 at 08:36:38PM -0400, James Blachly via Digitalmars-d-learn wrote: > On 9/24/20 6:22 PM, mw wrote: [...] > > I'm just wondering what's the best way to convert sysTime to local > > machine's time (zone)? [...] > It is definitely not easy to find. > > https://dlang.org/phobos/st

Re: what's the best way to convert a sysTime to local machine's time (zone)?

2020-09-24 Thread James Blachly via Digitalmars-d-learn
On 9/24/20 6:22 PM, mw wrote: Hi, I'm just wondering what's the best way to convert sysTime to local machine's time (zone)? Is there any library function does this already? https://dlang.org/phobos/std_datetime_systime.html#SysTime (The time in SysTime is kept internally in hnsecs from mid

what's the best way to convert a sysTime to local machine's time (zone)?

2020-09-24 Thread mw via Digitalmars-d-learn
Hi, I'm just wondering what's the best way to convert sysTime to local machine's time (zone)? Is there any library function does this already? https://dlang.org/phobos/std_datetime_systime.html#SysTime (The time in SysTime is kept internally in hnsecs from midnight, January 1st, 1 A.D. UTC

Re: Templates and unaryFun!

2020-09-24 Thread ddcovery via Digitalmars-d-learn
I think I will dedicate tonight one or two hours to understand the first two proposals :-D. On Thursday, 24 September 2020 at 13:28:25 UTC, WebFreak001 wrote: [...] Alternatively a lot easier would be to just return auto and do: auto dt(alias fun, T)(Dot!T t){ return t.dot(t => unaryFu

Re: Templates and unaryFun!

2020-09-24 Thread ddcovery via Digitalmars-d-learn
On Thursday, 24 September 2020 at 14:15:01 UTC, ddcovery wrote: [...] I think I will dedicate tonight one or two hours to understand the first two proposals :-D. [...] Not necessary, really simple and well explained WebFreak001!!!

Re: Templates and unaryFun!

2020-09-24 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 24 September 2020 at 11:15:11 UTC, ddcovery wrote: [...] Example: I tried with a global function Dot!R dt(alias fun, T, R)(Dot!T t){ auto f = cast(R function(T)) unaryFun!fun; return t.dot!R(f); } [...] the problem is the template can't automatically determine the type "R". A

Templates and unaryFun!

2020-09-24 Thread ddcovery via Digitalmars-d-learn
Last week, in general forum someone introduced the possibility to implement the .? operator in D: https://forum.dlang.org/thread/blnjoaleswqnaojou...@forum.dlang.org I decided to implement a simple solution with a funciontal syntax: string fatherName = dot(person).dot(a=>a.father).dot(a=>a.na

Re: Linking lib files

2020-09-24 Thread Joel via Digitalmars-d-learn
On Saturday, 4 July 2020 at 01:15:03 UTC, Joel wrote: Using Windows 10. In my dub.json file I have: "lflags" : ["+..\\DAllegro5\\lib\\"], But I get: Linking... lld-link: error: could not open '+..\DAllegro5\lib\': no such file or directory lld-link: error: could not open 'allegro.lib': no such

Re: How can I test at compile time whether T is an instance of an interface ?

2020-09-24 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 23 September 2020 at 20:19:04 UTC, data pulverizer wrote: Thinking more about it this ... class Middle: Node { Node prev; Node next; } won't work because the I've told the compiler that the static type is "Node", my original design was something like this: ``` struct Middle