View source code Display the source code in core/time.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Struct core.time.FracSec

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).

Properties

Name Type Description
hnsecs [get] int The value of this FracSec as hnsecs.
hnsecs [set] int The value of this FracSec as hnsecs.
msecs [get] int The value of this FracSec as milliseconds.
msecs [set] int The value of this FracSec as milliseconds.
nsecs [get] int The value of this FracSec as nsecs.
nsecs [set] long The value of this FracSec as nsecs.
usecs [get] int The value of this FracSec as microseconds.
usecs [set] int The value of this FracSec as microseconds.
zero [get] FracSec A FracSec of 0. It's shorter than doing something like FracSec.from!"msecs"(0) and more explicit than FracSec.init.

Methods

Name Description
from Create a FracSec from the given units ("msecs", "usecs", or "hnsecs").
opUnary Returns the negation of this FracSec.
toString Converts this TickDuration to a string.

Authors

Jonathan M Davis and Kato Shoichi

License

Boost License 1.0.

Comments