Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Convert a packed CTTIME into a string with whole second precision.

NOTE: See ctdbTimeMsecToString() if you need millisecond precision.


CTDBRET ctdbTimeToString(CTTIME Time, CTTIME_TYPE TimeType,

pTEXT pStr, VRLEN size)


ctdbTimeToString() converts a packed CTTIME into a string. To convert a packed CTTIME to seconds, use ctdbTimeToSeconds(). Use ctdbStringToTime() to convert from a string to CTTIME. Use ctdbDateToString() to convert a packed CTDATE into a string.

  • Time [in] the time, in CTTIME format.
  • TimeType [in] the time type. Valid types are listed in c-treeDB API Data Types.
  • pStr [out] the pointer to the string that will result from the conversion.
  • size [in] the buffer size of the string.


ctdbTimeToString() returns CTDBRET_OK on success, or c-treeDB API C API error on failure.

The possible errors associated with ctdbTimeToString() are:

  • CTDBRET_NULARG (4007): Null argument not valid in pStr
  • CTDBRET_INVFORMAT (4028): Invalid format in TimeType
  • CTDBRET_ARGSMALL (4006): Buffer is too small (increase size)

See also

ctdbTimeToSeconds(), ctdbStringToTime(), ctdbStringToTimeMsec(), ctdbTimeMsecToString(), ctdbDateToString(), ctdbDateTimeToString()