Add DateTime
Convenience Method
Declaration
TibrvStatusaddDateTime
(
const char* fieldName,
const TibrvMsgDateTime& value,
tibrv_u16 fieldId=0);
Purpose
Add a field containing a Rendezvous datetime value.
Parameter |
Description |
|
Create the new field with this name. |
|
Add a new field that contains this datetime value. The method copies the data into the new message field. |
|
Create the new field with this identifier. Zero is a special value that signifies no field identifier. All non-zero field identifiers must be unique within each message. It is illegal to add a field that has both a |
Example
This example code converts a time_t
value to a datetime value, and adds the datetime to a message field. Programs can adapt this example as appropriate. (For corresponding code to extract a datetime value from a message field, and convert it to a time_t
value, see the example at Get DateTime.)
#include <limits.h>
TibrvStatus addAsTimeT(
TibrvMsg& msg,
const char* field,
time_t value)
{
examples/c/ d;
d.sec = (tibrv_i64)value;
return msg.addDateTime(field,d);
}