company logo

Time :: compare - Compare time values

The function compares the time values. The function returns -1 when the time value is lower than the time passed time value, 1 when the the time value is greater than the one passed and 0, when both time values are equal.

The function throws an exception, when values are invalid or not comparable.

Return value:  Compare result ( int32  )

The result of a comparison is an integer value with the following meaning:

  • 0: both operands have the same value
  • 1: the calling operand is greater than the passed operand
  • -1: the calling operand is smaller than the passed operand

Implementation overview

Implementation details

  1. Compare time value with string data
    int32 Time  :: compare ( odaba::String &sTime )

    The function compares the time value with the time point passed in sTime.

    • sTime - Time value in string format

      Time values are passed as string value with the following format:

              hh[:mm[:ss[,cc]

      Time values must not contain spaces.

  2. to list
  3. Compare two time values
    int32 Time  :: compare ( odaba::Time &cTime )

    The function compares the time value with the time value passed in cTime.

    • cTime - Time value

      The time value is passed in the ODABA Interface::Time format and provides time in 1/100th seconds.

  4. to list