Open topic with navigation

TIBCO ActiveSpaces® 4.8.0

# 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* tibdgRow_GetDateTime(tibEx e, tibdgRow row, const char* columnName)

tibDateTime columns can be used for primary keys and for secondary indexes.

## 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;

The ActiveSpaces API can then be used to store the tibDateTime object into a row that is then stored into a table in the data grid.

Copyright © 2009-2022. Cloud Software Group, Inc. All Rights Reserved.