Allow implicit conversion from TimeSpan to Duration
Convert to days
Convenience function (older compilers don't allow public alias to package)
Convert to hours
Convert to a floating point interval representing seconds.
Convert to microseconds
Convert to milliseconds
Convert to minutes
Convert to nanoseconds
Add or subtract the TimeSpan given to this TimeSpan returning a new TimeSpan.
Scale the TimeSpan by the specified amount. This should not be used to convert to a different unit. Use the unit accessors instead. This should only be used as a scaling mechanism. For example, if you have a timeout and you want to sleep for twice the timeout, you would use timeout * 2. Returns a new TimeSpan.
Perform integer division with the given time span.
Compares this object against another TimeSpan value.
Determines whether two TimeSpan values are equal
Add or subtract the specified TimeSpan to this TimeSpan, assigning the result to this instance.
Scales this TimeSpan and assigns the result to this instance.
Negate a time span. Returns a new TimeSpan.
Convert to seconds
Get the number of ticks that this timespan represents.
Convert to TimeOfDay
Construct a TimeSpan from the given number of days
Construct a TimeSpan from the given number of hours
Construct a TimeSpan from the given interval. The interval represents seconds as a double. This allows both whole and fractional seconds to be passed in.
Construct a TimeSpan from the given number of microseconds
Construct a TimeSpan from the given number of milliseconds
Construct a TimeSpan from the given number of minutes
Construct a TimeSpan from the given number of nanoseconds
Construct a TimeSpan from the given number of seconds
Maximum TimeSpan
Minimum TimeSpan
Zero TimeSpan. Useful for comparisons.
Time start = Clock.now; Thread.sleep(0.150); Stdout.formatln("slept for {} ms", (Clock.now-start).millis);
ocean.core.Thread, ocean.time.Clock
This struct represents a length of time. The underlying representation is in units of 100ns. This allows the length of time to span to roughly +/- 10000 years.
Notably missing from this is a representation of weeks, months and years. This is because weeks, months, and years vary according to local calendars. Use ocean.time.chrono.* to deal with these concepts.
Note: nobody should change this struct without really good reason as it is required to be a part of some interfaces. It should be treated as a builtin type. Also note that there is deliberately no opCall constructor here, since it tends to produce too much overhead. If you wish to build a TimeSpan struct from a ticks value, use D's builtin ability to create a struct with given member values (See the description of ticks() for an example of how to do this).