View source code
Display the source code in std/datetime/systime.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
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.
std.datetime.systime.SysTime.fracSecs
- multiple declarations
Function SysTime.fracSecs
Fractional seconds past the second (i.e. the portion of a
SysTime
which is less than a second).
Example
import core .time : msecs, usecs, hnsecs, nsecs;
import std .datetime .date : DateTime;
auto dt = DateTime(1982, 4, 1, 20, 59, 22);
writeln(SysTime(dt, msecs(213)) .fracSecs); // msecs(213)
writeln(SysTime(dt, usecs(5202)) .fracSecs); // usecs(5202)
writeln(SysTime(dt, hnsecs(1234567)) .fracSecs); // hnsecs(1234567)
// SysTime and Duration both have a precision of hnsecs (100 ns),
// so nsecs are going to be truncated.
writeln(SysTime(dt, nsecs(123456789)) .fracSecs); // nsecs(123456700)
Function SysTime.fracSecs
Fractional seconds past the second (i.e. the portion of a
SysTime
which is less than a second).
Parameters
Name | Description |
---|---|
fracSecs | The duration to set this SysTime 's fractional
seconds to. |
Throws
DateTimeException
if the given duration
is negative or if it's greater than or equal to one second.
Example
import core .time : Duration, msecs, hnsecs, nsecs;
import std .datetime .date : DateTime;
auto st = SysTime(DateTime(1982, 4, 1, 20, 59, 22));
writeln(st .fracSecs); // Duration.zero
st .fracSecs = msecs(213);
writeln(st .fracSecs); // msecs(213)
st .fracSecs = hnsecs(1234567);
writeln(st .fracSecs); // hnsecs(1234567)
// SysTime has a precision of hnsecs (100 ns), so nsecs are
// going to be truncated.
st .fracSecs = nsecs(123456789);
writeln(st .fracSecs); // hnsecs(1234567)
Authors
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.