Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 18 Tuple : Tuple Operations : tibasTuple_PutDateTime()

tibasTuple_PutDateTime()
Function
Declaration
tibas_status tibasTuple_PutDateTime
(tibasTuple     tuple,
const char*     fieldName,
tibas_DateTime* value)
Purpose
Stores a datetime value in a specified field in a specified tuple.
Parameter
 
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);
 
See Also
tibasTuple_PutChar(), tibasTuple_PutShort(), tibasTuple_PutInt(), tibasTuple_PutLong(), tibasTuple_PutFloat(), tibasTuple_PutDouble(), tibasTuple_PutString(), tibasTuple_PutBoolean()tibasTuple_PutBlob(), tibasTuple_GetDateTime()
 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved