temp_tibDateTime_ExcludeFromTOC
ActiveSpaces tables can be defined, using
tibdg , with columns of type
datetime that are mapped internally to a
tibDateTime object for storing data into rows of the table. The following is the C API for setting and retrieving tibDateTime
objects into/from the rows of a table:
void tibdgRow_SetDateTime(tibEx e, tibdgRow row, const char *columnName, const tibDateTime *value)tibDateTime columns can be used for primary keys and for secondary indexes.
tibDateTime* tibdgRow_GetDateTime(tibEx e, tibdgRow row, const char* columnName)
Populating tibDateTime
Windows and Unix platforms use different structures for retrieving date/time data. The following are examples of how you can get the current date and time on each platform and populate a tibDateTime object:
Unix platforms
#include <sys/types.h> #include <sys/time.h> #include “tibdg/tibdg.h” struct timeval timebuffer; (void) gettimeofday(&timebuffer, NULL); tibDateTime dt; dt.sec = timebuffer.tv_sec; dt.nsec = timebuffer.tv_usec * 1000;
Windows
#include <sys/timeb.h> #include “tibdg/tibdg.h” truct __timeb64 timebuffer; ftime64_s(&timebuffer); ibDateTime dt; t.sec = timebuffer.time; dt.nsec = timebuffer.millitm * 1000000;