90 template<
typename duration_t,
typename period_t = std::ratio<1>>
154 auto operator *(
const time_span& value)
const -> double;
155 auto operator *(
double value)
const ->
time_span;
156 auto operator /(
const time_span& value)
const -> double;
157 auto operator /(
double value)
const ->
time_span;
164 friend auto operator << (std::ostream& os, const
time_span& value) -> std::ostream& {
return os << value.to_string();}
314 [[nodiscard]] auto
equals(const
object& value) const noexcept ->
bool override;
545 static constexpr
int32 millis_per_second = 1000;
546 static constexpr
int32 millis_per_minute = millis_per_second * 60;
547 static constexpr
int32 millis_per_hour = millis_per_minute * 60;
548 static constexpr
int32 millis_per_day = millis_per_hour * 24;
550 static constexpr
int32 parse_succeed = 0;
551 static constexpr
int32 parse_overflow = 1;
552 static constexpr
int32 parse_format = 2;
554 [[nodiscard]] static auto interval(
double value,
int scale) ->
time_span;
555 [[nodiscard]] auto make_string_from_duration(
bool constant) const ->
xtd::
string;
556 [[nodiscard]] static auto try_parse_internal(const
string& value,
time_span& result) ->
xtd::
int32;
Contains std::chrono::days, std::chrono::weeks, std::chrono::months and std::chrono::years duration t...
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.hpp:22
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
Represents a time interval.
Definition time_span.hpp:29
auto ticks_duration() const noexcept -> xtd::ticks
Gets the number of ticks that represent the value of the current xtd::time_span structure.
auto total_seconds_duration() const noexcept -> std::chrono::seconds
Gets the value of the current xtd::time_span structure expressed in whole and fractional seconds.
auto get_hash_code() const noexcept -> xtd::usize override
Serves as a hash function for a particular type.
static constexpr xtd::int64 ticks_per_millisecond
Represents the number of ticks in 1 millisecond. This field is constant.
Definition time_span.hpp:52
auto divide(const time_span &ts) const -> double
Returns a double value that's the result of dividing this instance by ts.
static constexpr xtd::int64 ticks_per_day
Represents the number of ticks in 1 day. This field is constant.
Definition time_span.hpp:68
static constexpr xtd::int64 ticks_per_minute
Represents the number of ticks in 1 minute. This field is constant.
Definition time_span.hpp:60
auto total_hours_duration() const noexcept -> std::chrono::hours
Gets the value of the current xtd::time_span structure expressed in whole and fractional hours.
auto seconds() const noexcept -> xtd::int32
Gets the seconds component of the time interval represented by the current xtd::time_span structure.
auto subtract(const time_span &ts) const noexcept -> time_span
Returns a new xtd::time_span object whose value is the difference between the specified xtd::time_spa...
time_span(xtd::int32 hours, xtd::int32 minutes, xtd::int32 seconds)
Initializes a new instance of the xtd::time_span structure to a specified number of hours,...
static auto from_milliseconds(double value) -> time_span
Returns a xtd::time_span that represents a specified number of milliseconds.
auto total_microseconds_duration() const noexcept -> std::chrono::microseconds
Gets the value of the current xtd::time_span structure expressed in whole and fractional microseconds...
auto total_days_duration() const noexcept -> std::chrono::days
Gets the value of the current xtd::time_span structure expressed in whole and fractional days.
static auto from_hours(double value) -> time_span
Returns a xtd::time_span that represents a specified number of hours, where the specification is accu...
auto total_milliseconds() const noexcept -> double
Gets the value of the current xtd::time_span structure expressed in whole and fractional milliseconds...
auto to_string() const noexcept -> xtd::string override
Returns a xtd::string that represents the current object.
time_span(xtd::int64 ticks)
Initializes a new instance of the xtd::time_span structure to the specified number of ticks.
static constexpr xtd::int64 nanoseconds_per_tick
Represents the number of nanoseconds per tick. This field is constant.
Definition time_span.hpp:44
static constexpr xtd::int64 ticks_per_second
Represents the number of ticks in 1 second.
Definition time_span.hpp:56
time_span(const std::chrono::duration< duration_t, period_t > &value)
Initializes a new instance of the xtd::time_span structure to the specified number of ticks.
Definition time_span.hpp:91
static auto parse(const string &value) -> time_span
Converts the string representation of a time interval to its xtd::time_span equivalent.
static const time_span min_value
Represents the minimum xtd::time_span value. This field is read-only.
Definition time_span.hpp:40
time_span(xtd::int32 days, xtd::int32 hours, xtd::int32 minutes, xtd::int32 seconds, xtd::int32 milliseconds, xtd::int32 microseconds, xtd::int32 nanoseconds)
Initializes a new instance of the xtd::time_span structure to a specified number of days,...
auto multiply(const time_span &ts) const noexcept -> double
Returns a new xtd::time_spam object which value is the result of multiplication of this instance and ...
auto total_milliseconds_duration() const noexcept -> std::chrono::milliseconds
Gets the value of the current xtd::time_span structure expressed in whole and fractional milliseconds...
auto nanoseconds() const noexcept -> xtd::int32
Gets the nanoseconds component of the time interval represented by the current xtd::time_span structu...
static auto from_microseconds(double value) -> time_span
Returns a xtd::time_span that represents a specified number of microseconds.
static constexpr xtd::int64 ticks_per_hour
Represents the number of ticks in 1 hour. This field is constant.
Definition time_span.hpp:64
auto total_nanoseconds() const noexcept -> double
Gets the value of the current xtd::time_span structure expressed in whole and fractional nanoseconds.
auto equals(const object &value) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
auto add(const time_span &ts) const noexcept -> time_span
Returns a new xtd::time_span object whose value is the sum of the specified xtd::time_span object and...
auto compare_to(const time_span &value) const noexcept -> xtd::int32 override
Compares the current instance with another object of the same type.
time_span(xtd::ticks ticks)
Initializes a new instance of the xtd::time_span structure to the specified number of ticks.
auto total_microseconds() const noexcept -> double
Gets the value of the current xtd::time_span structure expressed in whole and fractional microseconds...
static auto from_nanoseconds(double value) -> time_span
Returns a xtd::time_span that represents a specified number of nanoseconds.
static constexpr xtd::int64 ticks_per_microsecond
Represents the number of ticks in 1 microsecond. This field is constant.
Definition time_span.hpp:48
auto total_nanoseconds_duration() const noexcept -> std::chrono::nanoseconds
Gets the value of the current xtd::time_span structure expressed in whole and fractional nanoseconds.
auto milliseconds() const noexcept -> xtd::int32
Gets the milliseconds component of the time interval represented by the current xtd::time_span struct...
auto days() const noexcept -> xtd::int32
Gets the days component of the time interval represented by the current xtd::time_span structure.
static auto from_minutes(double value) -> time_span
Returns a xtd::time_span that represents a specified number of minutes, where the specification is ac...
auto total_days() const noexcept -> double
Gets the value of the current xtd::time_span structure expressed in whole and fractional days.
time_span(xtd::int32 days, xtd::int32 hours, xtd::int32 minutes, xtd::int32 seconds, xtd::int32 milliseconds)
Initializes a new instance of the xtd::time_span structure to a specified number of days,...
auto total_minutes() const noexcept -> double
Gets the value of the current xtd::time_span structure expressed in whole and fractional minutes.
auto total_seconds() const noexcept -> double
Gets the value of the current xtd::time_span structure expressed in whole and fractional seconds.
static const time_span max_value
Represents the maximum xtd::time_span value. This field is read-only.
Definition time_span.hpp:36
auto duration() const noexcept -> time_span
Returns a new xtd::time_span object whose value is the absolute value of the current xtd::time_span o...
auto total_hours() const noexcept -> double
Gets the value of the current xtd::time_span structure expressed in whole and fractional hours.
static auto try_parse(const string &value, time_span &result) -> bool
Converts the string representation of a time interval to its xtd::time_span equivalent and returns a ...
auto hours() const noexcept -> xtd::int32
Gets the hours component of the time interval represented by the current xtd::time_span structure.
static const time_span zero
Represents the zero xtd::time_span value. This field is read-only.
Definition time_span.hpp:72
static auto from_ticks(int64 value) -> time_span
Returns a xtd::time_spam that represents a specified time, where the specification is in units of tic...
auto negate() const -> time_span
Returns a new xtd::time_spam object whose value is the negated value of this instance.
auto minutes() const noexcept -> xtd::int32
Gets the minutes component of the time interval represented by the current xtd::time_span structure.
auto total_minutes_duration() const noexcept -> std::chrono::minutes
Gets the value of the current xtd::time_span structure expressed in whole and fractional minutes.
static auto from_days(double value) -> time_span
Returns a xtd::time_span that represents a specified number of days, where the specification is accur...
time_span(xtd::int32 days, xtd::int32 hours, xtd::int32 minutes, xtd::int32 seconds, xtd::int32 milliseconds, xtd::int32 microseconds)
Initializes a new instance of the xtd::time_span structure to a specified number of days,...
static auto from_seconds(double value) -> time_span
Returns a xtd::time_spam that represents a specified number of seconds, where the specification is ac...
auto microseconds() const noexcept -> xtd::int32
Gets the microseconds component of the time interval represented by the current xtd::time_span struct...
time_span(xtd::int32 days, xtd::int32 hours, xtd::int32 minutes, xtd::int32 seconds)
Initializes a new instance of the xtd::time_span structure to a specified number of days,...
auto ticks() const noexcept -> xtd::int64
Gets the number of ticks that represent the value of the current xtd::time_span structure.
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
std::int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:25
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
std::chrono::duration< int64, tick > ticks
Represents a tick duration.
Definition ticks.hpp:21
auto parse(const std::string &str) -> value_t
Convert a string into a type.
Definition parse.hpp:34
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
Contains xtd::time_span suffixes.
Contains classes that define culture-related information, including language, country/region,...
Definition culture_info.hpp:19
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::object class.
Contains xtd::parse methods.
Contains xtd::string alias.
Contains xtd::ticks typedef.
Contains xtd fundamental types.