SysTime.fracSecs

Fractional seconds past the second (i.e. the portion of a SysTime which is less than a second).

  1. Duration fracSecs [@property getter]
  2. Duration fracSecs [@property setter]
    struct SysTime
    @property @safe scope
    void
    fracSecs
    (
    Duration fracSecs
    )

Parameters

fracSecs Duration

The duration to set this SysTime's fractional seconds to.

Throws

std.datetime.date.DateTimeException if the given duration is negative or if it's greater than or equal to one second.

Examples

import core.time : Duration, msecs, hnsecs, nsecs;
import std.datetime.date : DateTime;

auto st = SysTime(DateTime(1982, 4, 1, 20, 59, 22));
assert(st.fracSecs == Duration.zero);

st.fracSecs = msecs(213);
assert(st.fracSecs == msecs(213));

st.fracSecs = hnsecs(1234567);
assert(st.fracSecs == hnsecs(1234567));

// SysTime has a precision of hnsecs (100 ns), so nsecs are
// going to be truncated.
st.fracSecs = nsecs(123456789);
assert(st.fracSecs == hnsecs(1234567));

Meta