On 20/01/2017 9:29 AM, Rene Zwanenburg wrote:
On Thursday, 19 January 2017 at 14:04:36 UTC, aberba wrote:
Using the standard library, how do a get number of hours or seconds or
minutes or days or months or years till current time from a past
timestamp (like "2 mins ago")? Not with manual calculations but from
Phobos functions.

You can get a duration by subtracting two timestamps. For example:

auto delta = (Clock.currTime - timeStamp).total!"seconds";

As per the documentation this is wrong for anything beyond a few weeks.
Although I have no idea if that's the case implementation wise.

Reply via email to