Re: What's a good wat to trunctate a time point

2017-05-10 Thread Biotronic via Digitalmars-d-learn
On Friday, 5 May 2017 at 09:14:21 UTC, Biotronic wrote: Here's an implementation that supports start of year, month, week, day, hour, minute and second. Works for DateTime and SysTime. Not heavily tested (all tests included): As the last sentence says, there were holes in the testing, specifi

Re: What's a good wat to trunctate a time point

2017-05-05 Thread Dukc via Digitalmars-d-learn
On Friday, 5 May 2017 at 09:14:21 UTC, Biotronic wrote: Here's an implementation that supports start of year, month, week, day, hour, minute and second. Works for DateTime and SysTime. Not heavily tested (all tests included): [lots of code] Wow! You might want to create a pr to phobos from

Re: What's a good wat to trunctate a time point

2017-05-05 Thread Biotronic via Digitalmars-d-learn
On Friday, 5 May 2017 at 08:02:15 UTC, Dukc wrote: I have a time point, be it SysTime or DateTime, whatever. I want to trunctate it to weeks, eg. I want it to become the first point of time during the week it was representing. What's a good way to do that? Only hacks came to my mind. The solu

What's a good wat to trunctate a time point

2017-05-05 Thread Dukc via Digitalmars-d-learn
I have a time point, be it SysTime or DateTime, whatever. I want to trunctate it to weeks, eg. I want it to become the first point of time during the week it was representing. What's a good way to do that? Only hacks came to my mind. The solution does not have to be generic, trough I'd prefer