FracSec

Everything in druntime and Phobos that was using FracSec now uses Duration for greater simplicity. So, FracSec has been deprecated. It will be removed from the docs in October 2018, and removed completely from druntime in October 2019.

Represents fractional seconds.

This is the portion of the time which is smaller than a second and it cannot hold values which would be greater than or equal to a second (or less than or equal to a negative second).

It holds hnsecs internally, but you can create it using either milliseconds, microseconds, or hnsecs. What it does is allow for a simple way to set or adjust the fractional seconds portion of a Duration or a std.datetime.SysTime without having to worry about whether you're dealing with milliseconds, microseconds, or hnsecs.

FracSec's functions which take time unit strings do accept "nsecs", but because the resolution of Duration and std.datetime.SysTime is hnsecs, you don't actually get precision higher than hnsecs. "nsecs" is accepted merely for convenience. Any values given as nsecs will be converted to hnsecs using convert (which uses truncating division when converting to smaller units).

Members

Functions

opUnary
FracSec opUnary()

Returns the negation of this FracSec.

toString
string toString()

Converts this TickDuration to a string.

Properties

hnsecs
int hnsecs [@property getter]

The value of this FracSec as hnsecs.

hnsecs
int hnsecs [@property setter]

The value of this FracSec as hnsecs.

msecs
int msecs [@property getter]

The value of this FracSec as milliseconds.

msecs
int msecs [@property setter]

The value of this FracSec as milliseconds.

nsecs
int nsecs [@property getter]

The value of this FracSec as nsecs.

nsecs
long nsecs [@property setter]

The value of this FracSec as nsecs.

usecs
int usecs [@property getter]

The value of this FracSec as microseconds.

usecs
int usecs [@property setter]

The value of this FracSec as microseconds.

zero
FracSec zero [@property getter]

A FracSec of 0. It's shorter than doing something like FracSec.from!"msecs"(0) and more explicit than FracSec.init.

Static functions

from
FracSec from(long value)

Create a FracSec from the given units ("msecs", "usecs", or "hnsecs").

Suggestion Box / Bug Report