Phobos: Determining number of hours or minutes or seconds till now

Rene Zwanenburg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 19 12:29:47 PST 2017


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";


More information about the Digitalmars-d-learn mailing list