Modul ncache.runtime.util.TimeSpan

Erweitern Sie den Quellcode
from datetime import datetime

from ncache.util.ExceptionHandler import ExceptionHandler
from ncache.util.JavaInstancesFactory import *
from ncache.util.TypeCaster import TypeCaster
from ncache.util.ValidateType import ValidateType


class TimeSpan:
    """
    Represents a time interval.
    """

    def __init__(self, ticks=None, hours=None, minutes=None, seconds=None, days=None, milliseconds=None):
        """
        Initialize an instance of TimeSpan Object

        :param hours: number of hours
        :type hours: int
        :param minutes: number of minutes
        :type minutes: int
        :param seconds: number of seconds
        :type seconds: int
        :param days: number of days
        :type days: int
        :param milliseconds: number of milliseconds
        :type milliseconds: int
        :param ticks: number of ticks
        :type ticks: int
        """
        if ticks is None and days is None and hours is None and minutes is None and seconds is None and milliseconds is None:
            self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")()
            return
        elif (hours is not None) and (minutes is not None) and (seconds is not None):
            ValidateType.is_int(hours)
            ValidateType.is_int(minutes)
            ValidateType.is_int(seconds)

            javahours = TypeCaster.to_java_primitive_type(hours)
            javaminutes = TypeCaster.to_java_primitive_type(minutes)
            javaseconds = TypeCaster.to_java_primitive_type(seconds)
            if days is not None:
                ValidateType.is_int(days)
                javadays = TypeCaster.to_java_primitive_type(days)
                if milliseconds is not None:
                    ValidateType.is_int(milliseconds)
                    javamilliseconds = TypeCaster.to_java_primitive_type(milliseconds)
                    self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")(javadays, javahours, javaminutes, javaseconds, javamilliseconds)
                    return

                self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")(javadays, javahours, javaminutes, javaseconds)
                return

            self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")(javahours, javaminutes, javaseconds)
            return
        elif ticks is not None and days is None and hours is None and minutes is None and seconds is None and milliseconds is None:
            ValidateType.is_int(ticks)
            self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")(TypeCaster.to_java_long(ticks))
            return
        else:
            raise ValueError(ExceptionHandler.exceptionmessages.get("TimeSpan.__init__"))

    def set_instance(self, value):
        self.__timespan = value

    def get_instance(self):
        return self.__timespan

    def add(self, timespan):
        """
        Returns a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.

        :param timespan: The time interval to add.
        :type timespan: TimeSpan
        :return: A new object that represents the value of this instance plus the value of timespan.
        :rtype: TimeSpan
        """
        ValidateType.type_check(timespan, TimeSpan, self.add)
        result = self.__timespan.Add(timespan.get_instance())
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan
        return result

    @staticmethod
    def compare(timespan1, timespan2):
        """
        Compares two TimeSpan values, returning an integer that indicates their relationship.

        :param timespan1: First TimeSpan object to be compared
        :type timespan1: TimeSpan
        :param timespan2: Second TimeSpan object to be compared
        :type timespan2: TimeSpan
        :return: A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than
            the specified object.
        :rtype: int
        """
        ValidateType.type_check(timespan1, TimeSpan, TimeSpan.compare)
        ValidateType.type_check(timespan2, TimeSpan, TimeSpan.compare)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").Compare(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def compare_to(self, timespan):
        """
        Compares this object with the specified object. Returns a negative integer, zero, or a positive integer as this
        object is less than, equal to, or greater than the specified object.

        :param timespan: The object to be compared with this object.
        :type timespan: TimeSpan
        :return: A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than
            the specified object.
        :rtype: int
        """
        ValidateType.type_check(timespan, TimeSpan, self.compare_to)

        result = self.__timespan.CompareTo(timespan.get_instance())
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def duration(self):
        """
        Returns a new TimeSpan object whose value is the absolute value of the current TimeSpan object.

        :return: A new object whose value is the absolute value of the current TimeSpan object.
        :rtype: TimeSpan
        """
        result = self.__timespan.Duration()
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan
        return result

    @staticmethod
    def to_equals(timespan1, timespan2):
        """
        Returns a value indicating whether two instances of TimeSpan are equal.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the values of t1 and t2 are equal; otherwise, false.
        """
        ValidateType.type_check(timespan1, TimeSpan, TimeSpan.to_equals)
        ValidateType.type_check(timespan2, TimeSpan, TimeSpan.to_equals)

        return bool(JavaInstancesFactory.get_java_instance("TimeSpan").equals(timespan1.get_instance(), timespan2.get_instance()))

    def equals(self, timespan):
        """
        Returns a value indicating whether this instance is equal to a specified TimeSpan object.

        :param timespan: An object to compare with this instance.
        :type timespan: TimeSpan
        :return: true if obj represents the same time interval as this instance; otherwise, false.
        :rtype: bool
        """
        ValidateType.type_check(timespan, TimeSpan, self.equals)

        return bool(self.__timespan.equals(timespan.get_instance()))

    @staticmethod
    def from_days(value):
        """
        Returns a TimeSpan that represents a specified number of days, where the specification is accurate to the
        nearest millisecond.

        :param value: A number of days, accurate to the nearest millisecond.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_days)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromDays(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_hours(value):
        """
        Returns a TimeSpan that represents a specified number of hours, where the specification is accurate to the
        nearest millisecond.

        :param value: A number of hours accurate to the nearest millisecond.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_hours)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromHours(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_milliseconds(value):
        """
        Returns a TimeSpan that represents a specified number of milliseconds.

        :param value: A number of milliseconds.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_milliseconds)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromMilliseconds(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_minutes(value):
        """
        Returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the
        nearest millisecond.

        :param value: A number of minutes, accurate to the nearest millisecond.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_minutes)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromMinutes(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_seconds(value):
        """
        Returns a TimeSpan that represents a specified number of seconds, where the specification is accurate to the
        nearest millisecond.

        :param value: A number of seconds, accurate to the nearest millisecond.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_seconds)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromSeconds(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_ticks(value):
        """
        Returns a TimeSpan that represents a specified time, where the specification is in units of ticks.

        :param value: A number of ticks that represent a time.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_ticks)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromTicks(TypeCaster.to_java_long(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    def get_days(self):
        """
        Gets the days component of the time interval represented by the current TimeSpan class.

        :return: The day component of this instance. The return value can be positive or negative.
        :rtype: int
        """
        result = self.__timespan.getDays()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_hours(self):
        """
        Gets the hours component of the time interval represented by the current TimeSpan class.

        :return: The hour component of the current TimeSpan class. The return value ranges from -23 through 23.
        :rtype: int
        """
        result = self.__timespan.getHours()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_milliseconds(self):
        """
        Gets the milliseconds component of the time interval represented by the current TimeSpan class.

        :return: The millisecond component of the current TimeSpan class. The return value ranges from -999 through 999.
        :rtype: int
        """
        result = self.__timespan.getMilliseconds()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_minutes(self):
        """
        Gets the minutes component of the time interval represented by the current TimeSpan class.

        :return: The minute component of the current TimeSpan class. The return value ranges from -59 through 59.
        :rtype: int
        """
        result = self.__timespan.getMinutes()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_seconds(self):
        """
        Gets the seconds component of the time interval represented by the current TimeSpan class.

        :return: The second component of the current TimeSpan class. The return value ranges from -59 through 59.
        :rtype: int
        """
        result = self.__timespan.getSeconds()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_days(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional days.

        :return: The total number of days represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalDays()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_hours(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional hours.

        :return: The total number of hours represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalHours()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_milliseconds(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional milliseconds.

        :return: The total number of milliseconds represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalMilliseconds()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_minutes(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional minutes.

        :return: The total number of minutes represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalMinutes()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_seconds(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional seconds.

        :return: The total number of seconds represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalSeconds()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_ticks(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional milliseconds.

        :return: The total number of ticks represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalTicks()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def __hash__(self):
        return TypeCaster.to_python_primitive_type(self.__timespan.hashCode())

    def negate(self):
        """
        Returns a new TimeSpan object whose value is the negated value of this instance.

        :return: A new object with the same numeric value as this instance, but with the opposite sign.
        :rtype: TimeSpan
        """
        result = self.__timespan.Negate()
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def op_addition(timespan1, timespan2):
        """
        Adds two specified TimeSpan instances.

        :param timespan1: The first time interval to add.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to add.
        :type timespan2: TimeSpan
        :return: An object whose value is the sum of the values of timespan1 and timespan2.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpAddition(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def op_equality(timespan1, timespan2):
        """
        Indicates whether two TimeSpan instances are equal.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the values of t1 and t2 are equal; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpEquality(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_greater_than(timespan1, timespan2):
        """
        Indicates whether a specified TimeSpan is greater than another specified TimeSpan.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the value of t1 is greater than the value of t2; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpGreaterThan(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_greater_than_or_equal(timespan1, timespan2):
        """
        Indicates whether a specified TimeSpan is greater than or equal to another specified TimeSpan.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the value of t1 is greater than or equal to the value of t2; otherwise,false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpGreaterThanOrEqual(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_inequality(timespan1, timespan2):
        """
        Indicates whether two TimeSpan instances are not equal.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the values of t1 and t2 are not equal; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpInequality(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_less_than(timespan1, timespan2):
        """
        Indicates whether a specified TimeSpan is less than another specified TimeSpan.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the value of t1 is less than the value of t2; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpLessThan(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_less_than_or_equal(timespan1, timespan2):
        """
        Indicates whether a specified TimeSpan is less than or equal to another specified TimeSpan.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the value of t1 is less than or equal to the value of t2; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpLessThanOrEqual(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_subtraction(timespan1, timespan2):
        """
        Subtracts a specified TimeSpan from another specified TimeSpan.

        :param timespan1: The minuend.
        :type timespan1: TimeSpan
        :param timespan2: The subtrahend.
        :type timespan2: TimeSpan
        :return: An object whose value is the result of the value of t1 minus the value of t2.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpSubtraction(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def op_unary_negation(timespan):
        """
        Returns a TimeSpan whose value is the negated value of the specified instance.

        :param timespan: The time interval to be negated.
        :type timespan: TimeSpan
        :return: An object that has the same numeric value as this instance, but the opposite sign.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpUnaryNegation(timespan.get_instance())

        if result is not None:
            pythontimespan = TimeSpan()
            pythontimespan.set_instance(result)
            return pythontimespan

        return result

    @staticmethod
    def op_unary_plus(timespan):
        """
        Returns the specified instance of TimeSpan.

        :param timespan: The time interval to return.
        :type timespan: TimeSpan
        :return: The time interval specified by t.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpUnaryPlus(timespan.get_instance())
        if result is not None:
            pythontimespan = TimeSpan()
            pythontimespan.set_instance(result)
            return pythontimespan

        return result

    @staticmethod
    def subtract(fromtime, totime):
        """
        Gets the difference between two dates in the form of a Timespan.

        :param fromtime: The first date value to compare.
        :type fromtime: datetime
        :param totime: The second date value to compare.
        :type totime: datetime
        :return: The timespan instance indicating the difference between the dates.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").subtract(TypeCaster.to_java_date(fromtime), TypeCaster.to_java_date(totime))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def time_to_ticks(hour, minute, second):
        """
        Converts the specified hour,minutes and seconds to equivalent ticks.

        :param hour: Number of hours.
        :type hour: int
        :param minute: Number of minutes.
        :type minute: int
        :param second: Number of seconds.
        :type second: int
        :return: The number of ticks equivalent to the specified time.
        :rtype: int
        """
        ValidateType.is_int(hour, TimeSpan.time_to_ticks)
        ValidateType.is_int(minute, TimeSpan.time_to_ticks)
        ValidateType.is_int(second, TimeSpan.time_to_ticks)

        javahour = TypeCaster.to_java_primitive_type(hour)
        javaminute = TypeCaster.to_java_primitive_type(minute)
        javasecond = TypeCaster.to_java_primitive_type(second)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").TimeToTicks(javahour, javaminute, javasecond)

        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    @staticmethod
    def time_span_zero():
        result = JavaInstancesFactory.get_java_instance("TimeSpan").Zero
        if result is not None:
            timespan = TimeSpan(0)
            timespan.set_instance(result)
            result = timespan

        return result

    @staticmethod
    def time_span_min_value():
        result = JavaInstancesFactory.get_java_instance("TimeSpan").MinValue
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def time_span_max_value():
        result = JavaInstancesFactory.get_java_instance("TimeSpan").MaxValue
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result


class TimeSpanUtil:
    zero_time_span = TimeSpan.time_span_zero()
    min_value_time_span = TimeSpan.time_span_min_value()
    max_value_time_span = TimeSpan.time_span_max_value()

Klassen

class TimeSpan (ticks=None, hours=None, minutes=None, seconds=None, days=None, milliseconds=None)

Stellt ein Zeitintervall dar.

Initialisieren Sie eine Instanz des TimeSpan-Objekts

:param Stunden: Anzahl der Stunden :Typ Stunden: int :param Minuten: Anzahl Minuten :Typ Minuten: int :param Sekunden: Anzahl Sekunden :Typ Sekunden: int :param Tage: Anzahl Tage :Typ Tage: int :param Millisekunden: Anzahl der Millisekunden :Typ Millisekunden: int :param ticks: Anzahl der Ticks :Typ ticks: int

Erweitern Sie den Quellcode
class TimeSpan:
    """
    Represents a time interval.
    """

    def __init__(self, ticks=None, hours=None, minutes=None, seconds=None, days=None, milliseconds=None):
        """
        Initialize an instance of TimeSpan Object

        :param hours: number of hours
        :type hours: int
        :param minutes: number of minutes
        :type minutes: int
        :param seconds: number of seconds
        :type seconds: int
        :param days: number of days
        :type days: int
        :param milliseconds: number of milliseconds
        :type milliseconds: int
        :param ticks: number of ticks
        :type ticks: int
        """
        if ticks is None and days is None and hours is None and minutes is None and seconds is None and milliseconds is None:
            self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")()
            return
        elif (hours is not None) and (minutes is not None) and (seconds is not None):
            ValidateType.is_int(hours)
            ValidateType.is_int(minutes)
            ValidateType.is_int(seconds)

            javahours = TypeCaster.to_java_primitive_type(hours)
            javaminutes = TypeCaster.to_java_primitive_type(minutes)
            javaseconds = TypeCaster.to_java_primitive_type(seconds)
            if days is not None:
                ValidateType.is_int(days)
                javadays = TypeCaster.to_java_primitive_type(days)
                if milliseconds is not None:
                    ValidateType.is_int(milliseconds)
                    javamilliseconds = TypeCaster.to_java_primitive_type(milliseconds)
                    self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")(javadays, javahours, javaminutes, javaseconds, javamilliseconds)
                    return

                self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")(javadays, javahours, javaminutes, javaseconds)
                return

            self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")(javahours, javaminutes, javaseconds)
            return
        elif ticks is not None and days is None and hours is None and minutes is None and seconds is None and milliseconds is None:
            ValidateType.is_int(ticks)
            self.__timespan = JavaInstancesFactory.get_java_instance("TimeSpan")(TypeCaster.to_java_long(ticks))
            return
        else:
            raise ValueError(ExceptionHandler.exceptionmessages.get("TimeSpan.__init__"))

    def set_instance(self, value):
        self.__timespan = value

    def get_instance(self):
        return self.__timespan

    def add(self, timespan):
        """
        Returns a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.

        :param timespan: The time interval to add.
        :type timespan: TimeSpan
        :return: A new object that represents the value of this instance plus the value of timespan.
        :rtype: TimeSpan
        """
        ValidateType.type_check(timespan, TimeSpan, self.add)
        result = self.__timespan.Add(timespan.get_instance())
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan
        return result

    @staticmethod
    def compare(timespan1, timespan2):
        """
        Compares two TimeSpan values, returning an integer that indicates their relationship.

        :param timespan1: First TimeSpan object to be compared
        :type timespan1: TimeSpan
        :param timespan2: Second TimeSpan object to be compared
        :type timespan2: TimeSpan
        :return: A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than
            the specified object.
        :rtype: int
        """
        ValidateType.type_check(timespan1, TimeSpan, TimeSpan.compare)
        ValidateType.type_check(timespan2, TimeSpan, TimeSpan.compare)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").Compare(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def compare_to(self, timespan):
        """
        Compares this object with the specified object. Returns a negative integer, zero, or a positive integer as this
        object is less than, equal to, or greater than the specified object.

        :param timespan: The object to be compared with this object.
        :type timespan: TimeSpan
        :return: A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than
            the specified object.
        :rtype: int
        """
        ValidateType.type_check(timespan, TimeSpan, self.compare_to)

        result = self.__timespan.CompareTo(timespan.get_instance())
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def duration(self):
        """
        Returns a new TimeSpan object whose value is the absolute value of the current TimeSpan object.

        :return: A new object whose value is the absolute value of the current TimeSpan object.
        :rtype: TimeSpan
        """
        result = self.__timespan.Duration()
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan
        return result

    @staticmethod
    def to_equals(timespan1, timespan2):
        """
        Returns a value indicating whether two instances of TimeSpan are equal.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the values of t1 and t2 are equal; otherwise, false.
        """
        ValidateType.type_check(timespan1, TimeSpan, TimeSpan.to_equals)
        ValidateType.type_check(timespan2, TimeSpan, TimeSpan.to_equals)

        return bool(JavaInstancesFactory.get_java_instance("TimeSpan").equals(timespan1.get_instance(), timespan2.get_instance()))

    def equals(self, timespan):
        """
        Returns a value indicating whether this instance is equal to a specified TimeSpan object.

        :param timespan: An object to compare with this instance.
        :type timespan: TimeSpan
        :return: true if obj represents the same time interval as this instance; otherwise, false.
        :rtype: bool
        """
        ValidateType.type_check(timespan, TimeSpan, self.equals)

        return bool(self.__timespan.equals(timespan.get_instance()))

    @staticmethod
    def from_days(value):
        """
        Returns a TimeSpan that represents a specified number of days, where the specification is accurate to the
        nearest millisecond.

        :param value: A number of days, accurate to the nearest millisecond.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_days)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromDays(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_hours(value):
        """
        Returns a TimeSpan that represents a specified number of hours, where the specification is accurate to the
        nearest millisecond.

        :param value: A number of hours accurate to the nearest millisecond.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_hours)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromHours(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_milliseconds(value):
        """
        Returns a TimeSpan that represents a specified number of milliseconds.

        :param value: A number of milliseconds.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_milliseconds)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromMilliseconds(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_minutes(value):
        """
        Returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the
        nearest millisecond.

        :param value: A number of minutes, accurate to the nearest millisecond.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_minutes)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromMinutes(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_seconds(value):
        """
        Returns a TimeSpan that represents a specified number of seconds, where the specification is accurate to the
        nearest millisecond.

        :param value: A number of seconds, accurate to the nearest millisecond.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_seconds)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromSeconds(TypeCaster.to_java_double(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def from_ticks(value):
        """
        Returns a TimeSpan that represents a specified time, where the specification is in units of ticks.

        :param value: A number of ticks that represent a time.
        :type value: int
        :return: An object that represents value.
        :rtype: TimeSpan
        """
        ValidateType.is_int(value, TimeSpan.from_ticks)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").FromTicks(TypeCaster.to_java_long(value))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    def get_days(self):
        """
        Gets the days component of the time interval represented by the current TimeSpan class.

        :return: The day component of this instance. The return value can be positive or negative.
        :rtype: int
        """
        result = self.__timespan.getDays()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_hours(self):
        """
        Gets the hours component of the time interval represented by the current TimeSpan class.

        :return: The hour component of the current TimeSpan class. The return value ranges from -23 through 23.
        :rtype: int
        """
        result = self.__timespan.getHours()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_milliseconds(self):
        """
        Gets the milliseconds component of the time interval represented by the current TimeSpan class.

        :return: The millisecond component of the current TimeSpan class. The return value ranges from -999 through 999.
        :rtype: int
        """
        result = self.__timespan.getMilliseconds()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_minutes(self):
        """
        Gets the minutes component of the time interval represented by the current TimeSpan class.

        :return: The minute component of the current TimeSpan class. The return value ranges from -59 through 59.
        :rtype: int
        """
        result = self.__timespan.getMinutes()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_seconds(self):
        """
        Gets the seconds component of the time interval represented by the current TimeSpan class.

        :return: The second component of the current TimeSpan class. The return value ranges from -59 through 59.
        :rtype: int
        """
        result = self.__timespan.getSeconds()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_days(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional days.

        :return: The total number of days represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalDays()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_hours(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional hours.

        :return: The total number of hours represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalHours()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_milliseconds(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional milliseconds.

        :return: The total number of milliseconds represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalMilliseconds()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_minutes(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional minutes.

        :return: The total number of minutes represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalMinutes()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_seconds(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional seconds.

        :return: The total number of seconds represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalSeconds()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def get_total_ticks(self):
        """
        Gets the value of the current TimeSpan class expressed in whole and fractional milliseconds.

        :return: The total number of ticks represented by this instance.
        :rtype: int
        """
        result = self.__timespan.getTotalTicks()
        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    def __hash__(self):
        return TypeCaster.to_python_primitive_type(self.__timespan.hashCode())

    def negate(self):
        """
        Returns a new TimeSpan object whose value is the negated value of this instance.

        :return: A new object with the same numeric value as this instance, but with the opposite sign.
        :rtype: TimeSpan
        """
        result = self.__timespan.Negate()
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def op_addition(timespan1, timespan2):
        """
        Adds two specified TimeSpan instances.

        :param timespan1: The first time interval to add.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to add.
        :type timespan2: TimeSpan
        :return: An object whose value is the sum of the values of timespan1 and timespan2.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpAddition(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def op_equality(timespan1, timespan2):
        """
        Indicates whether two TimeSpan instances are equal.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the values of t1 and t2 are equal; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpEquality(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_greater_than(timespan1, timespan2):
        """
        Indicates whether a specified TimeSpan is greater than another specified TimeSpan.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the value of t1 is greater than the value of t2; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpGreaterThan(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_greater_than_or_equal(timespan1, timespan2):
        """
        Indicates whether a specified TimeSpan is greater than or equal to another specified TimeSpan.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the value of t1 is greater than or equal to the value of t2; otherwise,false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpGreaterThanOrEqual(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_inequality(timespan1, timespan2):
        """
        Indicates whether two TimeSpan instances are not equal.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the values of t1 and t2 are not equal; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpInequality(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_less_than(timespan1, timespan2):
        """
        Indicates whether a specified TimeSpan is less than another specified TimeSpan.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the value of t1 is less than the value of t2; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpLessThan(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_less_than_or_equal(timespan1, timespan2):
        """
        Indicates whether a specified TimeSpan is less than or equal to another specified TimeSpan.

        :param timespan1: The first time interval to compare.
        :type timespan1: TimeSpan
        :param timespan2: The second time interval to compare.
        :type timespan2: TimeSpan
        :return: true if the value of t1 is less than or equal to the value of t2; otherwise, false.
        :rtype: bool
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpLessThanOrEqual(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            result = bool(result)

        return result

    @staticmethod
    def op_subtraction(timespan1, timespan2):
        """
        Subtracts a specified TimeSpan from another specified TimeSpan.

        :param timespan1: The minuend.
        :type timespan1: TimeSpan
        :param timespan2: The subtrahend.
        :type timespan2: TimeSpan
        :return: An object whose value is the result of the value of t1 minus the value of t2.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpSubtraction(timespan1.get_instance(), timespan2.get_instance())
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def op_unary_negation(timespan):
        """
        Returns a TimeSpan whose value is the negated value of the specified instance.

        :param timespan: The time interval to be negated.
        :type timespan: TimeSpan
        :return: An object that has the same numeric value as this instance, but the opposite sign.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpUnaryNegation(timespan.get_instance())

        if result is not None:
            pythontimespan = TimeSpan()
            pythontimespan.set_instance(result)
            return pythontimespan

        return result

    @staticmethod
    def op_unary_plus(timespan):
        """
        Returns the specified instance of TimeSpan.

        :param timespan: The time interval to return.
        :type timespan: TimeSpan
        :return: The time interval specified by t.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").OpUnaryPlus(timespan.get_instance())
        if result is not None:
            pythontimespan = TimeSpan()
            pythontimespan.set_instance(result)
            return pythontimespan

        return result

    @staticmethod
    def subtract(fromtime, totime):
        """
        Gets the difference between two dates in the form of a Timespan.

        :param fromtime: The first date value to compare.
        :type fromtime: datetime
        :param totime: The second date value to compare.
        :type totime: datetime
        :return: The timespan instance indicating the difference between the dates.
        :rtype: TimeSpan
        """
        result = JavaInstancesFactory.get_java_instance("TimeSpan").subtract(TypeCaster.to_java_date(fromtime), TypeCaster.to_java_date(totime))
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def time_to_ticks(hour, minute, second):
        """
        Converts the specified hour,minutes and seconds to equivalent ticks.

        :param hour: Number of hours.
        :type hour: int
        :param minute: Number of minutes.
        :type minute: int
        :param second: Number of seconds.
        :type second: int
        :return: The number of ticks equivalent to the specified time.
        :rtype: int
        """
        ValidateType.is_int(hour, TimeSpan.time_to_ticks)
        ValidateType.is_int(minute, TimeSpan.time_to_ticks)
        ValidateType.is_int(second, TimeSpan.time_to_ticks)

        javahour = TypeCaster.to_java_primitive_type(hour)
        javaminute = TypeCaster.to_java_primitive_type(minute)
        javasecond = TypeCaster.to_java_primitive_type(second)

        result = JavaInstancesFactory.get_java_instance("TimeSpan").TimeToTicks(javahour, javaminute, javasecond)

        if result is not None:
            result = TypeCaster.to_python_primitive_type(result)
        return result

    @staticmethod
    def time_span_zero():
        result = JavaInstancesFactory.get_java_instance("TimeSpan").Zero
        if result is not None:
            timespan = TimeSpan(0)
            timespan.set_instance(result)
            result = timespan

        return result

    @staticmethod
    def time_span_min_value():
        result = JavaInstancesFactory.get_java_instance("TimeSpan").MinValue
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

    @staticmethod
    def time_span_max_value():
        result = JavaInstancesFactory.get_java_instance("TimeSpan").MaxValue
        if result is not None:
            timespan = TimeSpan()
            timespan.set_instance(result)
            return timespan

        return result

Statische Methoden

def compare(timespan1, timespan2)

Vergleicht zwei TimeSpan-Werte und gibt eine Ganzzahl zurück, die ihre Beziehung angibt.

:param timespan1: Erstes zu vergleichendes TimeSpan-Objekt :type timespan1: TimeSpan :param timespan2: Zweites zu vergleichendes TimeSpan-Objekt :type timespan2: TimeSpan :return: Eine negative Ganzzahl, Null oder eine positive Ganzzahl, da dieses Objekt kleiner ist als gleich oder größer als das angegebene Objekt. :rtype: int

Erweitern Sie den Quellcode
@staticmethod
def compare(timespan1, timespan2):
    """
    Compares two TimeSpan values, returning an integer that indicates their relationship.

    :param timespan1: First TimeSpan object to be compared
    :type timespan1: TimeSpan
    :param timespan2: Second TimeSpan object to be compared
    :type timespan2: TimeSpan
    :return: A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than
        the specified object.
    :rtype: int
    """
    ValidateType.type_check(timespan1, TimeSpan, TimeSpan.compare)
    ValidateType.type_check(timespan2, TimeSpan, TimeSpan.compare)

    result = JavaInstancesFactory.get_java_instance("TimeSpan").Compare(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def from_days(value)

Gibt einen TimeSpan zurück, der eine angegebene Anzahl von Tagen darstellt, wobei die Angabe auf die nächste Millisekunde genau ist.

:param-Wert: Eine Anzahl von Tagen, auf die nächste Millisekunde genau. :type value: int :return: Ein Objekt, das einen Wert darstellt. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def from_days(value):
    """
    Returns a TimeSpan that represents a specified number of days, where the specification is accurate to the
    nearest millisecond.

    :param value: A number of days, accurate to the nearest millisecond.
    :type value: int
    :return: An object that represents value.
    :rtype: TimeSpan
    """
    ValidateType.is_int(value, TimeSpan.from_days)

    result = JavaInstancesFactory.get_java_instance("TimeSpan").FromDays(TypeCaster.to_java_double(value))
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def from_hours(value)

Gibt einen TimeSpan zurück, der eine angegebene Anzahl von Stunden darstellt, wobei die Angabe auf die nächste Millisekunde genau ist.

:param-Wert: Eine auf die nächste Millisekunde genaue Anzahl von Stunden. :type value: int :return: Ein Objekt, das einen Wert darstellt. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def from_hours(value):
    """
    Returns a TimeSpan that represents a specified number of hours, where the specification is accurate to the
    nearest millisecond.

    :param value: A number of hours accurate to the nearest millisecond.
    :type value: int
    :return: An object that represents value.
    :rtype: TimeSpan
    """
    ValidateType.is_int(value, TimeSpan.from_hours)

    result = JavaInstancesFactory.get_java_instance("TimeSpan").FromHours(TypeCaster.to_java_double(value))
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def from_milliseconds(value)

Gibt eine TimeSpan zurück, die eine angegebene Anzahl von Millisekunden darstellt.

:param-Wert: Eine Anzahl von Millisekunden. :type value: int :return: Ein Objekt, das einen Wert darstellt. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def from_milliseconds(value):
    """
    Returns a TimeSpan that represents a specified number of milliseconds.

    :param value: A number of milliseconds.
    :type value: int
    :return: An object that represents value.
    :rtype: TimeSpan
    """
    ValidateType.is_int(value, TimeSpan.from_milliseconds)

    result = JavaInstancesFactory.get_java_instance("TimeSpan").FromMilliseconds(TypeCaster.to_java_double(value))
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def from_minutes(value)

Gibt einen TimeSpan zurück, der eine angegebene Anzahl von Minuten darstellt, wobei die Angabe auf die nächste Millisekunde genau ist.

:param-Wert: Eine Anzahl von Minuten, auf die nächste Millisekunde genau. :type value: int :return: Ein Objekt, das einen Wert darstellt. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def from_minutes(value):
    """
    Returns a TimeSpan that represents a specified number of minutes, where the specification is accurate to the
    nearest millisecond.

    :param value: A number of minutes, accurate to the nearest millisecond.
    :type value: int
    :return: An object that represents value.
    :rtype: TimeSpan
    """
    ValidateType.is_int(value, TimeSpan.from_minutes)

    result = JavaInstancesFactory.get_java_instance("TimeSpan").FromMinutes(TypeCaster.to_java_double(value))
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def from_seconds(value)

Gibt einen TimeSpan zurück, der eine angegebene Anzahl von Sekunden darstellt, wobei die Angabe auf die nächste Millisekunde genau ist.

:param-Wert: Eine Anzahl von Sekunden, auf die nächste Millisekunde genau. :type value: int :return: Ein Objekt, das einen Wert darstellt. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def from_seconds(value):
    """
    Returns a TimeSpan that represents a specified number of seconds, where the specification is accurate to the
    nearest millisecond.

    :param value: A number of seconds, accurate to the nearest millisecond.
    :type value: int
    :return: An object that represents value.
    :rtype: TimeSpan
    """
    ValidateType.is_int(value, TimeSpan.from_seconds)

    result = JavaInstancesFactory.get_java_instance("TimeSpan").FromSeconds(TypeCaster.to_java_double(value))
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def from_ticks(value)

Gibt einen TimeSpan zurück, der eine angegebene Zeit darstellt, wobei die Angabe in Tick-Einheiten erfolgt.

:param-Wert: Eine Anzahl von Ticks, die eine Zeit darstellen. :type value: int :return: Ein Objekt, das einen Wert darstellt. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def from_ticks(value):
    """
    Returns a TimeSpan that represents a specified time, where the specification is in units of ticks.

    :param value: A number of ticks that represent a time.
    :type value: int
    :return: An object that represents value.
    :rtype: TimeSpan
    """
    ValidateType.is_int(value, TimeSpan.from_ticks)

    result = JavaInstancesFactory.get_java_instance("TimeSpan").FromTicks(TypeCaster.to_java_long(value))
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def op_addition(timespan1, timespan2)

Fügt zwei angegebene TimeSpan-Instanzen hinzu.

:param timespan1: Das erste hinzuzufügende Zeitintervall. :type timespan1: TimeSpan :param timespan2: Das zweite hinzuzufügende Zeitintervall. :type timespan2: TimeSpan :return: Ein Objekt, dessen Wert die Summe der Werte von timespan1 und timespan2 ist. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def op_addition(timespan1, timespan2):
    """
    Adds two specified TimeSpan instances.

    :param timespan1: The first time interval to add.
    :type timespan1: TimeSpan
    :param timespan2: The second time interval to add.
    :type timespan2: TimeSpan
    :return: An object whose value is the sum of the values of timespan1 and timespan2.
    :rtype: TimeSpan
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpAddition(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def op_equality(timespan1, timespan2)

Gibt an, ob zwei TimeSpan-Instanzen gleich sind.

:param timespan1: Das erste zu vergleichende Zeitintervall. :type timespan1: TimeSpan :param timespan2: Das zweite zu vergleichende Zeitintervall. :type timespan2: TimeSpan :return: true, wenn die Werte von t1 und t2 gleich sind; andernfalls falsch. :rtype: bool

Erweitern Sie den Quellcode
@staticmethod
def op_equality(timespan1, timespan2):
    """
    Indicates whether two TimeSpan instances are equal.

    :param timespan1: The first time interval to compare.
    :type timespan1: TimeSpan
    :param timespan2: The second time interval to compare.
    :type timespan2: TimeSpan
    :return: true if the values of t1 and t2 are equal; otherwise, false.
    :rtype: bool
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpEquality(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        result = bool(result)

    return result
def op_greater_than(timespan1, timespan2)

Gibt an, ob eine angegebene TimeSpan größer als eine andere angegebene TimeSpan ist.

:param timespan1: Das erste zu vergleichende Zeitintervall. :type timespan1: TimeSpan :param timespan2: Das zweite zu vergleichende Zeitintervall. :type timespan2: TimeSpan :return: true, wenn der Wert von t1 größer als der Wert von t2 ist; andernfalls falsch. :rtype: bool

Erweitern Sie den Quellcode
@staticmethod
def op_greater_than(timespan1, timespan2):
    """
    Indicates whether a specified TimeSpan is greater than another specified TimeSpan.

    :param timespan1: The first time interval to compare.
    :type timespan1: TimeSpan
    :param timespan2: The second time interval to compare.
    :type timespan2: TimeSpan
    :return: true if the value of t1 is greater than the value of t2; otherwise, false.
    :rtype: bool
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpGreaterThan(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        result = bool(result)

    return result
def op_greater_than_or_equal(timespan1, timespan2)

Gibt an, ob eine angegebene TimeSpan größer oder gleich einer anderen angegebenen TimeSpan ist.

:param timespan1: Das erste zu vergleichende Zeitintervall. :type timespan1: TimeSpan :param timespan2: Das zweite zu vergleichende Zeitintervall. :type timespan2: TimeSpan :return: true, wenn der Wert von t1 größer oder gleich dem Wert von t2 ist; andernfalls falsch. :rtype: bool

Erweitern Sie den Quellcode
@staticmethod
def op_greater_than_or_equal(timespan1, timespan2):
    """
    Indicates whether a specified TimeSpan is greater than or equal to another specified TimeSpan.

    :param timespan1: The first time interval to compare.
    :type timespan1: TimeSpan
    :param timespan2: The second time interval to compare.
    :type timespan2: TimeSpan
    :return: true if the value of t1 is greater than or equal to the value of t2; otherwise,false.
    :rtype: bool
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpGreaterThanOrEqual(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        result = bool(result)

    return result
def op_inequality(timespan1, timespan2)

Gibt an, ob zwei TimeSpan-Instanzen ungleich sind.

:param timespan1: Das erste zu vergleichende Zeitintervall. :type timespan1: TimeSpan :param timespan2: Das zweite zu vergleichende Zeitintervall. :type timespan2: TimeSpan :return: true, wenn die Werte von t1 und t2 nicht gleich sind; andernfalls falsch. :rtype: bool

Erweitern Sie den Quellcode
@staticmethod
def op_inequality(timespan1, timespan2):
    """
    Indicates whether two TimeSpan instances are not equal.

    :param timespan1: The first time interval to compare.
    :type timespan1: TimeSpan
    :param timespan2: The second time interval to compare.
    :type timespan2: TimeSpan
    :return: true if the values of t1 and t2 are not equal; otherwise, false.
    :rtype: bool
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpInequality(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        result = bool(result)

    return result
def op_less_than(timespan1, timespan2)

Gibt an, ob eine angegebene TimeSpan kleiner als eine andere angegebene TimeSpan ist.

:param timespan1: Das erste zu vergleichende Zeitintervall. :type timespan1: TimeSpan :param timespan2: Das zweite zu vergleichende Zeitintervall. :type timespan2: TimeSpan :return: true, wenn der Wert von t1 kleiner als der Wert von t2 ist; andernfalls falsch. :rtype: bool

Erweitern Sie den Quellcode
@staticmethod
def op_less_than(timespan1, timespan2):
    """
    Indicates whether a specified TimeSpan is less than another specified TimeSpan.

    :param timespan1: The first time interval to compare.
    :type timespan1: TimeSpan
    :param timespan2: The second time interval to compare.
    :type timespan2: TimeSpan
    :return: true if the value of t1 is less than the value of t2; otherwise, false.
    :rtype: bool
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpLessThan(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        result = bool(result)

    return result
def op_less_than_or_equal(timespan1, timespan2)

Gibt an, ob eine angegebene TimeSpan kleiner oder gleich einer anderen angegebenen TimeSpan ist.

:param timespan1: Das erste zu vergleichende Zeitintervall. :type timespan1: TimeSpan :param timespan2: Das zweite zu vergleichende Zeitintervall. :type timespan2: TimeSpan :return: true, wenn der Wert von t1 kleiner oder gleich dem Wert von t2 ist; andernfalls falsch. :rtype: bool

Erweitern Sie den Quellcode
@staticmethod
def op_less_than_or_equal(timespan1, timespan2):
    """
    Indicates whether a specified TimeSpan is less than or equal to another specified TimeSpan.

    :param timespan1: The first time interval to compare.
    :type timespan1: TimeSpan
    :param timespan2: The second time interval to compare.
    :type timespan2: TimeSpan
    :return: true if the value of t1 is less than or equal to the value of t2; otherwise, false.
    :rtype: bool
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpLessThanOrEqual(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        result = bool(result)

    return result
def op_subtraction(timespan1, timespan2)

Subtrahiert eine angegebene TimeSpan von einer anderen angegebenen TimeSpan.

:param timespan1: Der Minuend. :type timespan1: TimeSpan :param timespan2: Der Subtrahend. :type timespan2: TimeSpan :return: Ein Objekt, dessen Wert das Ergebnis des Werts von t1 minus dem Wert von t2 ist. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def op_subtraction(timespan1, timespan2):
    """
    Subtracts a specified TimeSpan from another specified TimeSpan.

    :param timespan1: The minuend.
    :type timespan1: TimeSpan
    :param timespan2: The subtrahend.
    :type timespan2: TimeSpan
    :return: An object whose value is the result of the value of t1 minus the value of t2.
    :rtype: TimeSpan
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpSubtraction(timespan1.get_instance(), timespan2.get_instance())
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def op_unary_negation(timespan)

Gibt eine TimeSpan zurück, deren Wert der negierte Wert der angegebenen Instanz ist.

:param timespan: Das zu negierende Zeitintervall. :type timespan: TimeSpan :return: Ein Objekt, das denselben numerischen Wert wie diese Instanz, aber das umgekehrte Vorzeichen hat. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def op_unary_negation(timespan):
    """
    Returns a TimeSpan whose value is the negated value of the specified instance.

    :param timespan: The time interval to be negated.
    :type timespan: TimeSpan
    :return: An object that has the same numeric value as this instance, but the opposite sign.
    :rtype: TimeSpan
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpUnaryNegation(timespan.get_instance())

    if result is not None:
        pythontimespan = TimeSpan()
        pythontimespan.set_instance(result)
        return pythontimespan

    return result
def op_unary_plus(timespan)

Gibt die angegebene Instanz von TimeSpan zurück.

:param timespan: Das zurückzugebende Zeitintervall. :type timespan: TimeSpan :return: Das durch t angegebene Zeitintervall. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def op_unary_plus(timespan):
    """
    Returns the specified instance of TimeSpan.

    :param timespan: The time interval to return.
    :type timespan: TimeSpan
    :return: The time interval specified by t.
    :rtype: TimeSpan
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").OpUnaryPlus(timespan.get_instance())
    if result is not None:
        pythontimespan = TimeSpan()
        pythontimespan.set_instance(result)
        return pythontimespan

    return result
def subtract(fromtime, totime)

Ruft die Differenz zwischen zwei Daten in Form einer Zeitspanne ab.

:param fromtime: Der erste zu vergleichende Datumswert. :type fromtime: datetime :param totime: Der zweite zu vergleichende Datumswert. :type totime: datetime :return: Die Zeitspanneninstanz, die den Unterschied zwischen den Datumsangaben angibt. :rtype: TimeSpan

Erweitern Sie den Quellcode
@staticmethod
def subtract(fromtime, totime):
    """
    Gets the difference between two dates in the form of a Timespan.

    :param fromtime: The first date value to compare.
    :type fromtime: datetime
    :param totime: The second date value to compare.
    :type totime: datetime
    :return: The timespan instance indicating the difference between the dates.
    :rtype: TimeSpan
    """
    result = JavaInstancesFactory.get_java_instance("TimeSpan").subtract(TypeCaster.to_java_date(fromtime), TypeCaster.to_java_date(totime))
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def time_span_max_value()
Erweitern Sie den Quellcode
@staticmethod
def time_span_max_value():
    result = JavaInstancesFactory.get_java_instance("TimeSpan").MaxValue
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def time_span_min_value()
Erweitern Sie den Quellcode
@staticmethod
def time_span_min_value():
    result = JavaInstancesFactory.get_java_instance("TimeSpan").MinValue
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def time_span_zero()
Erweitern Sie den Quellcode
@staticmethod
def time_span_zero():
    result = JavaInstancesFactory.get_java_instance("TimeSpan").Zero
    if result is not None:
        timespan = TimeSpan(0)
        timespan.set_instance(result)
        result = timespan

    return result
def time_to_ticks(hour, minute, second)

Konvertiert die angegebenen Stunden, Minuten und Sekunden in entsprechende Ticks.

:param Stunde: Anzahl der Stunden. :type Stunde: int :param Minute: Anzahl der Minuten. :type Minute: int :param Sekunde: Anzahl der Sekunden. :type Sekunde: int :return: Die Anzahl der Ticks, die der angegebenen Zeit entsprechen. :rtype: int

Erweitern Sie den Quellcode
@staticmethod
def time_to_ticks(hour, minute, second):
    """
    Converts the specified hour,minutes and seconds to equivalent ticks.

    :param hour: Number of hours.
    :type hour: int
    :param minute: Number of minutes.
    :type minute: int
    :param second: Number of seconds.
    :type second: int
    :return: The number of ticks equivalent to the specified time.
    :rtype: int
    """
    ValidateType.is_int(hour, TimeSpan.time_to_ticks)
    ValidateType.is_int(minute, TimeSpan.time_to_ticks)
    ValidateType.is_int(second, TimeSpan.time_to_ticks)

    javahour = TypeCaster.to_java_primitive_type(hour)
    javaminute = TypeCaster.to_java_primitive_type(minute)
    javasecond = TypeCaster.to_java_primitive_type(second)

    result = JavaInstancesFactory.get_java_instance("TimeSpan").TimeToTicks(javahour, javaminute, javasecond)

    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def to_equals(timespan1, timespan2)

Gibt einen Wert zurück, der angibt, ob zwei Instanzen von TimeSpan gleich sind.

:param timespan1: Das erste zu vergleichende Zeitintervall. :type timespan1: TimeSpan :param timespan2: Das zweite zu vergleichende Zeitintervall. :type timespan2: TimeSpan :return: true, wenn die Werte von t1 und t2 gleich sind; andernfalls falsch.

Erweitern Sie den Quellcode
@staticmethod
def to_equals(timespan1, timespan2):
    """
    Returns a value indicating whether two instances of TimeSpan are equal.

    :param timespan1: The first time interval to compare.
    :type timespan1: TimeSpan
    :param timespan2: The second time interval to compare.
    :type timespan2: TimeSpan
    :return: true if the values of t1 and t2 are equal; otherwise, false.
    """
    ValidateType.type_check(timespan1, TimeSpan, TimeSpan.to_equals)
    ValidateType.type_check(timespan2, TimeSpan, TimeSpan.to_equals)

    return bool(JavaInstancesFactory.get_java_instance("TimeSpan").equals(timespan1.get_instance(), timespan2.get_instance()))

Methoden

def add(self, timespan)

Gibt ein neues TimeSpan-Objekt zurück, dessen Wert die Summe des angegebenen TimeSpan-Objekts und dieser Instanz ist.

:param timespan: Das hinzuzufügende Zeitintervall. :type timespan: TimeSpan :return: Ein neues Objekt, das den Wert dieser Instanz plus den Wert von timespan darstellt. :rtype: TimeSpan

Erweitern Sie den Quellcode
def add(self, timespan):
    """
    Returns a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.

    :param timespan: The time interval to add.
    :type timespan: TimeSpan
    :return: A new object that represents the value of this instance plus the value of timespan.
    :rtype: TimeSpan
    """
    ValidateType.type_check(timespan, TimeSpan, self.add)
    result = self.__timespan.Add(timespan.get_instance())
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan
    return result
def compare_to(self, timespan)

Vergleicht dieses Objekt mit dem angegebenen Objekt. Gibt eine negative Ganzzahl, Null oder eine positive Ganzzahl zurück, da dieses Objekt kleiner, gleich oder größer als das angegebene Objekt ist.

:param timespan: Das Objekt, das mit diesem Objekt verglichen werden soll. :type timespan: TimeSpan :return: Eine negative Ganzzahl, Null oder eine positive Ganzzahl, da dieses Objekt kleiner, gleich oder größer als das angegebene Objekt ist. :rtype: int

Erweitern Sie den Quellcode
def compare_to(self, timespan):
    """
    Compares this object with the specified object. Returns a negative integer, zero, or a positive integer as this
    object is less than, equal to, or greater than the specified object.

    :param timespan: The object to be compared with this object.
    :type timespan: TimeSpan
    :return: A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than
        the specified object.
    :rtype: int
    """
    ValidateType.type_check(timespan, TimeSpan, self.compare_to)

    result = self.__timespan.CompareTo(timespan.get_instance())
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def duration(self)

Gibt ein neues TimeSpan-Objekt zurück, dessen Wert der absolute Wert des aktuellen TimeSpan-Objekts ist.

:return: Ein neues Objekt, dessen Wert der absolute Wert des aktuellen TimeSpan-Objekts ist. :rtype: TimeSpan

Erweitern Sie den Quellcode
def duration(self):
    """
    Returns a new TimeSpan object whose value is the absolute value of the current TimeSpan object.

    :return: A new object whose value is the absolute value of the current TimeSpan object.
    :rtype: TimeSpan
    """
    result = self.__timespan.Duration()
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan
    return result
def equals(self, timespan)

Gibt einen Wert zurück, der angibt, ob diese Instanz gleich einem angegebenen TimeSpan-Objekt ist.

:param timespan: Ein Objekt zum Vergleich mit dieser Instanz. :type timespan: TimeSpan :return: true, wenn obj das gleiche Zeitintervall wie diese Instanz darstellt; andernfalls falsch. :rtype: bool

Erweitern Sie den Quellcode
def equals(self, timespan):
    """
    Returns a value indicating whether this instance is equal to a specified TimeSpan object.

    :param timespan: An object to compare with this instance.
    :type timespan: TimeSpan
    :return: true if obj represents the same time interval as this instance; otherwise, false.
    :rtype: bool
    """
    ValidateType.type_check(timespan, TimeSpan, self.equals)

    return bool(self.__timespan.equals(timespan.get_instance()))
def get_days(self)

Ruft die Tageskomponente des Zeitintervalls ab, das durch die aktuelle TimeSpan-Klasse dargestellt wird.

:return: Die Tageskomponente dieser Instanz. Der Rückgabewert kann positiv oder negativ sein. :rtype: int

Erweitern Sie den Quellcode
def get_days(self):
    """
    Gets the days component of the time interval represented by the current TimeSpan class.

    :return: The day component of this instance. The return value can be positive or negative.
    :rtype: int
    """
    result = self.__timespan.getDays()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_hours(self)

Ruft die Stundenkomponente des Zeitintervalls ab, das von der aktuellen TimeSpan-Klasse dargestellt wird.

:return: Die Stundenkomponente der aktuellen TimeSpan-Klasse. Der Rückgabewert reicht von -23 bis 23. :rtype: int

Erweitern Sie den Quellcode
def get_hours(self):
    """
    Gets the hours component of the time interval represented by the current TimeSpan class.

    :return: The hour component of the current TimeSpan class. The return value ranges from -23 through 23.
    :rtype: int
    """
    result = self.__timespan.getHours()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_instance(self)
Erweitern Sie den Quellcode
def get_instance(self):
    return self.__timespan
def get_milliseconds(self)

Ruft die Millisekundenkomponente des Zeitintervalls ab, das durch die aktuelle TimeSpan-Klasse dargestellt wird.

:return: Die Millisekundenkomponente der aktuellen TimeSpan-Klasse. Der Rückgabewert reicht von -999 bis 999. :rtype: int

Erweitern Sie den Quellcode
def get_milliseconds(self):
    """
    Gets the milliseconds component of the time interval represented by the current TimeSpan class.

    :return: The millisecond component of the current TimeSpan class. The return value ranges from -999 through 999.
    :rtype: int
    """
    result = self.__timespan.getMilliseconds()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_minutes(self)

Ruft die Minutenkomponente des Zeitintervalls ab, das durch die aktuelle TimeSpan-Klasse dargestellt wird.

:return: Die Minutenkomponente der aktuellen TimeSpan-Klasse. Der Rückgabewert reicht von -59 bis 59. :rtype: int

Erweitern Sie den Quellcode
def get_minutes(self):
    """
    Gets the minutes component of the time interval represented by the current TimeSpan class.

    :return: The minute component of the current TimeSpan class. The return value ranges from -59 through 59.
    :rtype: int
    """
    result = self.__timespan.getMinutes()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_seconds(self)

Ruft die Sekundenkomponente des Zeitintervalls ab, das von der aktuellen TimeSpan-Klasse dargestellt wird.

:return: Die zweite Komponente der aktuellen TimeSpan-Klasse. Der Rückgabewert reicht von -59 bis 59. :rtype: int

Erweitern Sie den Quellcode
def get_seconds(self):
    """
    Gets the seconds component of the time interval represented by the current TimeSpan class.

    :return: The second component of the current TimeSpan class. The return value ranges from -59 through 59.
    :rtype: int
    """
    result = self.__timespan.getSeconds()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_total_days(self)

Ruft den Wert der aktuellen TimeSpan-Klasse ab, ausgedrückt in ganzen Tagen und Bruchteilen von Tagen.

:return: Die Gesamtzahl der von dieser Instanz repräsentierten Tage. :rtype: int

Erweitern Sie den Quellcode
def get_total_days(self):
    """
    Gets the value of the current TimeSpan class expressed in whole and fractional days.

    :return: The total number of days represented by this instance.
    :rtype: int
    """
    result = self.__timespan.getTotalDays()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_total_hours(self)

Ruft den Wert der aktuellen TimeSpan-Klasse ab, ausgedrückt in ganzen Stunden und Bruchteilen von Stunden.

:return: Die Gesamtzahl der Stunden, die von dieser Instanz dargestellt werden. :rtype: int

Erweitern Sie den Quellcode
def get_total_hours(self):
    """
    Gets the value of the current TimeSpan class expressed in whole and fractional hours.

    :return: The total number of hours represented by this instance.
    :rtype: int
    """
    result = self.__timespan.getTotalHours()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_total_milliseconds(self)

Ruft den Wert der aktuellen TimeSpan-Klasse ab, ausgedrückt in ganzen Millisekunden und Bruchteilen von Millisekunden.

:return: Die Gesamtzahl der Millisekunden, die von dieser Instanz dargestellt werden. :rtype: int

Erweitern Sie den Quellcode
def get_total_milliseconds(self):
    """
    Gets the value of the current TimeSpan class expressed in whole and fractional milliseconds.

    :return: The total number of milliseconds represented by this instance.
    :rtype: int
    """
    result = self.__timespan.getTotalMilliseconds()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_total_minutes(self)

Ruft den Wert der aktuellen TimeSpan-Klasse ab, ausgedrückt in ganzen Minuten und Minutenbruchteilen.

:return: Die Gesamtzahl der Minuten, die von dieser Instanz dargestellt werden. :rtype: int

Erweitern Sie den Quellcode
def get_total_minutes(self):
    """
    Gets the value of the current TimeSpan class expressed in whole and fractional minutes.

    :return: The total number of minutes represented by this instance.
    :rtype: int
    """
    result = self.__timespan.getTotalMinutes()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_total_seconds(self)

Ruft den Wert der aktuellen TimeSpan-Klasse ab, ausgedrückt in ganzen Sekunden und Sekundenbruchteilen.

:return: Die Gesamtzahl der Sekunden, die von dieser Instanz dargestellt werden. :rtype: int

Erweitern Sie den Quellcode
def get_total_seconds(self):
    """
    Gets the value of the current TimeSpan class expressed in whole and fractional seconds.

    :return: The total number of seconds represented by this instance.
    :rtype: int
    """
    result = self.__timespan.getTotalSeconds()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def get_total_ticks(self)

Ruft den Wert der aktuellen TimeSpan-Klasse ab, ausgedrückt in ganzen Millisekunden und Bruchteilen von Millisekunden.

:return: Die Gesamtzahl der von dieser Instanz dargestellten Ticks. :rtype: int

Erweitern Sie den Quellcode
def get_total_ticks(self):
    """
    Gets the value of the current TimeSpan class expressed in whole and fractional milliseconds.

    :return: The total number of ticks represented by this instance.
    :rtype: int
    """
    result = self.__timespan.getTotalTicks()
    if result is not None:
        result = TypeCaster.to_python_primitive_type(result)
    return result
def negate(self)

Gibt ein neues TimeSpan-Objekt zurück, dessen Wert der negierte Wert dieser Instanz ist.

:return: Ein neues Objekt mit demselben numerischen Wert wie diese Instanz, aber mit umgekehrtem Vorzeichen. :rtype: TimeSpan

Erweitern Sie den Quellcode
def negate(self):
    """
    Returns a new TimeSpan object whose value is the negated value of this instance.

    :return: A new object with the same numeric value as this instance, but with the opposite sign.
    :rtype: TimeSpan
    """
    result = self.__timespan.Negate()
    if result is not None:
        timespan = TimeSpan()
        timespan.set_instance(result)
        return timespan

    return result
def set_instance(self, value)
Erweitern Sie den Quellcode
def set_instance(self, value):
    self.__timespan = value
class TimeSpanUtil
Erweitern Sie den Quellcode
class TimeSpanUtil:
    zero_time_span = TimeSpan.time_span_zero()
    min_value_time_span = TimeSpan.time_span_min_value()
    max_value_time_span = TimeSpan.time_span_max_value()

Klassenvariablen

var max_value_time_span
var min_value_time_span
var zero_time_span