Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Convert a time in string format to CTTIME packed format with whole second precision.

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


CTDBRET ctdbStringToTime(pTEXT pStr, CTTIME_TYPE TimeType,

pCTTIME pTime)


ctdbStringToTime() converts a time in string format to CTTIME packed format. Use ctdbTimeToString() to convert a packed CTTIME into a string.

  • pStr [in] the pointer to the string.
  • TimeType [in] the time types. Valid types described in c-treeDB API Data Types.
  • pTime [out] the pointer to a CTTIME value that will result from the conversion.


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

The possible errors associated with ctdbStringToTime() are:

  • CTDBRET_NULARG (4007): Null argument not valid in pStr
  • CTDBRET_NOMEMORY (4001): Not enough memory
  • CTDBRET_INVFORMAT (4028): Invalid format in TimeType
  • CTDBRET_INVTIME (4033): Invalid packed CTTIME

See also

ctdbTimeToString(), ctdbStringToTimeMsec(), ctdbTimeMsecToString()