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)
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);
Copyright © Cloud Software Group, Inc. All rights reserved.
