company logo

Time :: assign - Set time value

The function provides different ways for setting a time value.

Return value:  Time value ( odaba::Time & )

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

Implementation overview

Implementation details

  1. Copy time value
    odaba::Time & Time  :: assign ( odaba::Time &cTime )

    The function copies 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.

  2. to list
  3. Set unix time from time value
    odaba::Time & Time  :: assign ( int64 iUnixTime )

    The function returns a Unix timestamp from the time value. As date 'today' is assumed.

    When true has been passed in bLocalTime, the time value is considered as local time and will be converted to Greenwich mean time (UTC) before storing the ODABA time value.

    • iUnixTime - Unix time stamp

      The unix timestamp contains the number of seconds since 1.1.1970 0:00:00 (UTC), which is an absolute timestamp that might be converted into local time.

  4. to list
  5. Set time value to number of centiseconds
    odaba::Time & Time  :: assign ( int32 iCentiseconds )

    The value passed in iCentiSeconds is considered as time value converted to number of centiseconds and stored as time value. It is up to the application to interpret the time value as local or standard time value.

    • iCentiseconds - Centiseconds

      Time span in hundredths of a second or centiseconds in a time value.

  6. to list
  7. Create an empty time value
    odaba::Time & Time  :: assign (  )

    The function initializes time to empty.

  8. to list
  9. Set time value from hours, minutes, seconds and centiseconds
    odaba::Time & Time  :: assign ( int32 iHour, int32 iMinute, int32 iSecond, int32 iCentisecond )

    The time value is set according to the values passed to iHour:iMinute:iSecond,iCentisecond.

    When any of the passed values is less than 0 or iHours is greater than 23, iCentisecond is greater 99 or iMinute or iSecond is greater than 59, the function throws an exception.


    • iHour - Hour

      Hour of the day. The value should range from 0 to 23.

    • iMinute - Minute

      Minute of the hour. The value should range from 0 to 59.

    • iSecond - Second

      Second of the minute. The value should range from 0 to 59.

    • iCentisecond - Centisecond

      Part (in hundredths) of the second. The value should range from 0 to 100.

  10. to list
  11. Set local time value from unix timestamp
    odaba::Time & Time  :: assign ( int64 iUnixTime, bool bLocalTime )

    The Unix timestamp, which is passed in iUnixTime, contains the number of seconds since 1.1.1970 0:00:00 (UTC).

    When true has been passed in bLocalTime, the timestamp is supposed to contain a standard time value (UTC) and will be adjusted to local time before being converted into an ODABA date/time value. Depending on winter and summer time and region the function may return different values.

    When false has been passed in bLocalTime, the timestamp is supposed to contain local time value or the application is responsible for proper interpretation.

    • iUnixTime - Unix time stamp

      The unix timestamp contains the number of seconds since 1.1.1970 0:00:00 (UTC), which is an absolute timestamp that might be converted into local time.

    • bLocalTime - Local or standard time

      The option indicates, that a time value or timestamp contains local time (true) or Greenwich standard time (false).

  12. to list
  13. Set time from string value
    odaba::Time & Time  :: assign ( odaba::String &sTime )

    The time value is set to the time value passed in string format.

    • 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.

  14. to list