tibasTuple_PutDateTime()

Stores a datetime value in a specified field in a specified tuple.

Declaration

tibas_status tibasTuple_PutDateTime
(tibasTuple     tuple,
const char*     fieldName,
tibas_DateTime* value)

Parameter

Parameter Description
tuple Specify the tuple into which you want to put a datetime value.
fieldName The fieldname.
value A _tibasDateTime struct that specifies the datetime value to store in the fieldname.

Remarks

Use the tibasTuple_PutDateTime() function to put a specified datetime value in a specified field in a specified tuple.

The value field must specofy a tibas_dateTime structure. The _tibasDateTime struct is defined as follows:

struct _tibasDateTime {
    tibas_long sec;
    tibas_int nsec;
};

The members in the _tibas_dateTime struct are defined as follows:

sec
 Specifies the time, in seconds, since the UNIX EPOCH time (1970-01-01 00:00:00 +0000).
nsec
 Specifies the time, in nanoseconds, since the UNIX EPOCH time (1970-01-01 00:00:00 +0000). This field provides is extra timing information in addition to the number of seconds since the EPOCH time; usually this is set to 0.

Example

The following example is taken from the ASOperations.c example program provided with the TIBCO ActiveSpaces distribution.

#include <time.h>
tibasTuple newValueTuple;
tibasTuple oldValueTuple;
tibasDateTime datetime;
time_t t;
tibas_status status;
printf("Put: Enter the key (integer): ");
gets(inputBuffer);
if (strcmp(inputBuffer, "") == 0) continue;
key = atoi(inputBuffer);
printf("Put: Enter the value (string): ");
            gets(inputBuffer);
/* Create a tuple and put the key into it. */
tibasTuple_Create(&newValueTuple);
tibasTuple_PutInt(newValueTuple, "key", key);
time(&t);
datetime.sec = (tibas_long) t;
datetime.nsec = 0;
tibasTuple_PutDateTime(newValueTuple, "time", datetime);