diff --git a/demos/esp32_spi_flash/main/main.c b/demos/esp32_spi_flash/main/main.c index 069a32a..1a5d5d4 100644 --- a/demos/esp32_spi_flash/main/main.c +++ b/demos/esp32_spi_flash/main/main.c @@ -32,8 +32,6 @@ static struct fdb_default_kv_node default_kv_table[] = { static struct fdb_kvdb kvdb = {0}; /* TSDB object */ struct fdb_tsdb tsdb = {0}; -/* counts for simulated timestamp */ -static int counts = 0; static SemaphoreHandle_t s_lock = NULL; extern void kvdb_basic_sample(fdb_kvdb_t kvdb); @@ -51,14 +49,6 @@ static void unlock(fdb_db_t db) xSemaphoreGive(s_lock); } -static fdb_time_t get_time(void) -{ - /* Using the counts instead of timestamp. - * Please change this function to return RTC time. - */ - return ++counts; -} - int flashdb_demo(void) { fdb_err_t result; @@ -114,13 +104,11 @@ int flashdb_demo(void) * "log": database name * "fdb_tsdb1": The flash partition name base on FAL. Please make sure it's in FAL partition table. * Please change to YOUR partition name. - * get_time: The get current timestamp function. + * NULL: Function to get the current timestamp. Define if using RTC; leaving empty (NULL) uses sequential time. * 128: maximum length of each log * NULL: The user data if you need, now is empty. */ - result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", get_time, 128, NULL); - /* read last saved time for simulated timestamp */ - fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &counts); + result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", NULL, 128, NULL); if (result != FDB_NO_ERR) { diff --git a/demos/esp8266_spi_flash/main/hello_world_main.c b/demos/esp8266_spi_flash/main/hello_world_main.c index 89a987a..ff68b1a 100644 --- a/demos/esp8266_spi_flash/main/hello_world_main.c +++ b/demos/esp8266_spi_flash/main/hello_world_main.c @@ -30,8 +30,6 @@ static struct fdb_default_kv_node default_kv_table[] = { static struct fdb_kvdb kvdb = { 0 }; /* TSDB object */ struct fdb_tsdb tsdb = { 0 }; -/* counts for simulated timestamp */ -static int counts = 0; static SemaphoreHandle_t s_lock = NULL; extern void kvdb_basic_sample(fdb_kvdb_t kvdb); @@ -49,14 +47,6 @@ static void unlock(fdb_db_t db) xSemaphoreGive(s_lock); } -static fdb_time_t get_time(void) -{ - /* Using the counts instead of timestamp. - * Please change this function to return RTC time. - */ - return ++counts; -} - int flashdb_demo(void) { fdb_err_t result; @@ -110,13 +100,11 @@ int flashdb_demo(void) * "log": database name * "fdb_tsdb1": The flash partition name base on FAL. Please make sure it's in FAL partition table. * Please change to YOUR partition name. - * get_time: The get current timestamp function. + * NULL: Function to get the current timestamp. Define if using RTC; leaving empty (NULL) uses sequential time. * 128: maximum length of each log * NULL: The user data if you need, now is empty. */ - result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", get_time, 128, NULL); - /* read last saved time for simulated timestamp */ - fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &counts); + result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", NULL, 128, NULL); if (result != FDB_NO_ERR) { return -1; diff --git a/demos/linux/applications/main.c b/demos/linux/applications/main.c index 975d124..3bd005d 100644 --- a/demos/linux/applications/main.c +++ b/demos/linux/applications/main.c @@ -27,8 +27,6 @@ static struct fdb_default_kv_node default_kv_table[] = { static struct fdb_kvdb kvdb = { 0 }; /* TSDB object */ struct fdb_tsdb tsdb = { 0 }; -/* counts for simulated timestamp */ -static int counts = 0; extern void kvdb_basic_sample(fdb_kvdb_t kvdb); extern void kvdb_type_string_sample(fdb_kvdb_t kvdb); @@ -45,8 +43,10 @@ static void unlock(fdb_db_t db) pthread_mutex_unlock((pthread_mutex_t *)db->user_data); } -static fdb_time_t get_time(void) +static fdb_time_t get_time(fdb_tsdb_t db) { + /* db not used to get time */ + (void)db; return time(NULL); } @@ -125,8 +125,6 @@ int main(void) * ts_locker: The locker object. */ result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", get_time, 128, &ts_locker); - /* read last saved time for simulated timestamp */ - fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &counts); if (result != FDB_NO_ERR) { return -1; diff --git a/demos/stm32f103ve/applications/main.c b/demos/stm32f103ve/applications/main.c index 29971e8..efe1349 100644 --- a/demos/stm32f103ve/applications/main.c +++ b/demos/stm32f103ve/applications/main.c @@ -28,8 +28,6 @@ static struct fdb_default_kv_node default_kv_table[] = { static struct fdb_kvdb kvdb = { 0 }; /* TSDB object */ struct fdb_tsdb tsdb = { 0 }; -/* counts for simulated timestamp */ -static int counts = 0; extern void kvdb_basic_sample(fdb_kvdb_t kvdb); extern void kvdb_type_string_sample(fdb_kvdb_t kvdb); @@ -46,14 +44,6 @@ static void unlock(fdb_db_t db) __enable_irq(); } -static fdb_time_t get_time(void) -{ - /* Using the counts instead of timestamp. - * Please change this function to return RTC time. - */ - return ++counts; -} - int main(void) { fdb_err_t result; @@ -102,13 +92,11 @@ int main(void) * "log": database name * "fdb_tsdb1": The flash partition name base on FAL. Please make sure it's in FAL partition table. * Please change to YOUR partition name. - * get_time: The get current timestamp function. + * NULL: Function to get the current timestamp. Define if using RTC; leaving empty (NULL) uses sequential time. * 128: maximum length of each log * NULL: The user data if you need, now is empty. */ - result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", get_time, 128, NULL); - /* read last saved time for simulated timestamp */ - fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &counts); + result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", NULL, 128, NULL); if (result != FDB_NO_ERR) { return -1; diff --git a/demos/stm32f405rg/applications/main.c b/demos/stm32f405rg/applications/main.c index 70573c6..05b8c6e 100644 --- a/demos/stm32f405rg/applications/main.c +++ b/demos/stm32f405rg/applications/main.c @@ -28,8 +28,6 @@ static struct fdb_default_kv_node default_kv_table[] = { static struct fdb_kvdb kvdb = { 0 }; /* TSDB object */ struct fdb_tsdb tsdb = { 0 }; -/* counts for simulated timestamp */ -static int counts = 0; extern void kvdb_basic_sample(fdb_kvdb_t kvdb); extern void kvdb_type_string_sample(fdb_kvdb_t kvdb); @@ -46,14 +44,6 @@ static void unlock(fdb_db_t db) __enable_irq(); } -static fdb_time_t get_time(void) -{ - /* Using the counts instead of timestamp. - * Please change this function to return RTC time. - */ - return ++counts; -} - int main(void) { fdb_err_t result; @@ -102,13 +92,11 @@ int main(void) * "log": database name * "fdb_tsdb1": The flash partition name base on FAL. Please make sure it's in FAL partition table. * Please change to YOUR partition name. - * get_time: The get current timestamp function. + * NULL: Function to get the current timestamp. Define if using RTC; leaving empty (NULL) uses sequential time. * 128: maximum length of each log * NULL: The user data if you need, now is empty. */ - result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", get_time, 128, NULL); - /* read last saved time for simulated timestamp */ - fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &counts); + result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", NULL, 128, NULL); if (result != FDB_NO_ERR) { return -1; diff --git a/demos/stm32f405rg_spi_flash/applications/main.c b/demos/stm32f405rg_spi_flash/applications/main.c index 70573c6..05b8c6e 100644 --- a/demos/stm32f405rg_spi_flash/applications/main.c +++ b/demos/stm32f405rg_spi_flash/applications/main.c @@ -28,8 +28,6 @@ static struct fdb_default_kv_node default_kv_table[] = { static struct fdb_kvdb kvdb = { 0 }; /* TSDB object */ struct fdb_tsdb tsdb = { 0 }; -/* counts for simulated timestamp */ -static int counts = 0; extern void kvdb_basic_sample(fdb_kvdb_t kvdb); extern void kvdb_type_string_sample(fdb_kvdb_t kvdb); @@ -46,14 +44,6 @@ static void unlock(fdb_db_t db) __enable_irq(); } -static fdb_time_t get_time(void) -{ - /* Using the counts instead of timestamp. - * Please change this function to return RTC time. - */ - return ++counts; -} - int main(void) { fdb_err_t result; @@ -102,13 +92,11 @@ int main(void) * "log": database name * "fdb_tsdb1": The flash partition name base on FAL. Please make sure it's in FAL partition table. * Please change to YOUR partition name. - * get_time: The get current timestamp function. + * NULL: Function to get the current timestamp. Define if using RTC; leaving empty (NULL) uses sequential time. * 128: maximum length of each log * NULL: The user data if you need, now is empty. */ - result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", get_time, 128, NULL); - /* read last saved time for simulated timestamp */ - fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &counts); + result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", NULL, 128, NULL); if (result != FDB_NO_ERR) { return -1; diff --git a/docs/api.md b/docs/api.md index e638732..ff265ff 100644 --- a/docs/api.md +++ b/docs/api.md @@ -250,7 +250,7 @@ Using this iterator API, all KVs in the entire KVDB can be traversed. | db | Database Objects | | name | Database name | | path | FAL mode: the partition name in the partition table, file mode: the path where the database is saved | -| get_time | Function to get the current timestamp | +| get_time | Function to get the current timestamp, NULL to use the default sequential timestamps. | | max_len | Maximum length of each TSL | | user_data | User-defined data, NULL if not available | | Return | Error Code | diff --git a/docs/demo-details.md b/docs/demo-details.md index ba8601e..2210281 100644 --- a/docs/demo-details.md +++ b/docs/demo-details.md @@ -53,13 +53,11 @@ In the demo project, the `main function` in `main.c` is the entry function. This * "log": database name * "fdb_tsdb1": The flash partition name base on FAL. Please make sure it's in FAL partition table. * Please change to YOUR partition name. - * get_time: The get current timestamp function. + * NULL: Function to get the current timestamp. Define if using RTC; leaving empty (NULL) uses sequential time. * 128: maximum length of each log * NULL: The user data if you need, now is empty. */ - result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", get_time, 128, NULL); - /* read last saved time for simulated timestamp */ - fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &counts); + result = fdb_tsdb_init(&tsdb, "log", "fdb_tsdb1", NULL, 128, NULL); if (result != FDB_NO_ERR) { return -1; @@ -86,9 +84,9 @@ For bare metal platforms, the lock and unlock callbacks are usually set to close #### timestamp simulation -For TSDB, the timestamp in the normal project should be obtained through RTC or network clock, but here to enhance the versatility of the demonstration project, use `fdb_tsdb_control(&tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &counts);` to get the last used timestamp of TSDB, Deposit in `counts`. Every time you use `get_time` to get the current time, it will add one to `counts` to simulate the action of moving forward in time and avoid repetition. +In a normal TSDB project, the application should define the get_time function to obtain timestamps from a RTC. In this demonstration project, to keep things simple, passing NULL as the get_time function causes TSDB to use a default timestamp function that increments the last timestamp by one for each record, simulating forward-moving time. -Therefore, the time stamp simulated by this method does not have the meaning of real-time time, just to make the time stamp inserted in each record not repeated. +Tip: If you don’t need RTC timestamps and want to reduce flash usage, you can enable FDB_TSDB_USING_SEQ_MODE in fdb_cfg_template.h #### Example diff --git a/inc/fdb_cfg_template.h b/inc/fdb_cfg_template.h index f8bde78..0151837 100644 --- a/inc/fdb_cfg_template.h +++ b/inc/fdb_cfg_template.h @@ -29,6 +29,13 @@ * Warning: If defined will be incompatible with variable blob flash store or if fixed blob size is later changed */ /* #define FDB_TSDB_FIXED_BLOB_SIZE 4 */ + +/* Use sequential mode - eliminates per-entry timestamp storage by calculating timestamps + * on-the-fly, saving sizeof(fdb_time_t). + * In this mode, timestamps increment by 1; providing a non-NULL get_time causes an ASSERT. + * Warning: If defined will be incompatible with time flash store */ +/* #define FDB_TSDB_USING_SEQ_MODE */ + /* Using FAL storage mode */ #define FDB_USING_FAL_MODE diff --git a/inc/fdb_def.h b/inc/fdb_def.h index 559fd6b..c410230 100644 --- a/inc/fdb_def.h +++ b/inc/fdb_def.h @@ -109,7 +109,10 @@ if (!(EXPR)) \ typedef int32_t fdb_time_t; #endif /* FDB_USING_TIMESTAMP_64BIT */ -typedef fdb_time_t (*fdb_get_time)(void); +struct fdb_tsdb; +typedef struct fdb_tsdb *fdb_tsdb_t; + +typedef fdb_time_t (*fdb_get_time)(fdb_tsdb_t db); struct fdb_default_kv_node { char *key; @@ -329,7 +332,6 @@ struct fdb_tsdb { void *user_data; }; -typedef struct fdb_tsdb *fdb_tsdb_t; /* blob structure */ struct fdb_blob { diff --git a/src/fdb_tsdb.c b/src/fdb_tsdb.c index bc53375..9d0168b 100644 --- a/src/fdb_tsdb.c +++ b/src/fdb_tsdb.c @@ -36,7 +36,11 @@ #define SECTOR_HDR_DATA_SIZE (FDB_WG_ALIGN(sizeof(struct sector_hdr_data))) #define LOG_IDX_DATA_SIZE (FDB_WG_ALIGN(sizeof(struct log_idx_data))) +#ifdef FDB_TSDB_USING_SEQ_MODE +#define LOG_IDX_TS_OFFSET ((unsigned long)(&((struct log_idx_data *)0)->log_len)) +#else #define LOG_IDX_TS_OFFSET ((unsigned long)(&((struct log_idx_data *)0)->time)) +#endif #define SECTOR_MAGIC_OFFSET ((unsigned long)(&((struct sector_hdr_data *)0)->magic)) #define SECTOR_START_TIME_OFFSET ((unsigned long)(&((struct sector_hdr_data *)0)->start_time)) #define SECTOR_END0_TIME_OFFSET ((unsigned long)(&((struct sector_hdr_data *)0)->end_info[0].time)) @@ -93,7 +97,9 @@ typedef struct sector_hdr_data *sector_hdr_data_t; /* time series log node index data */ struct log_idx_data { uint8_t status_table[TSL_STATUS_TABLE_SIZE]; /**< node status, @see fdb_tsl_status_t */ +#ifndef FDB_TSDB_USING_SEQ_MODE fdb_time_t time; /**< node timestamp */ +#endif #ifndef FDB_TSDB_FIXED_BLOB_SIZE uint32_t log_len; /**< node total length (header + name + value), must align by FDB_WRITE_GRAN */ uint32_t log_addr; /**< node address */ @@ -113,6 +119,8 @@ struct check_sec_hdr_cb_args { uint32_t empty_addr; }; +static fdb_time_t fdb_default_get_time(fdb_tsdb_t db); + static fdb_err_t read_tsl(fdb_tsdb_t db, fdb_tsl_t tsl) { struct log_idx_data idx; @@ -125,18 +133,26 @@ static fdb_err_t read_tsl(fdb_tsdb_t db, fdb_tsl_t tsl) tsl->addr.log = FDB_DATA_UNUSED; tsl->time = 0; } else { -#ifdef FDB_TSDB_FIXED_BLOB_SIZE +#if defined(FDB_TSDB_FIXED_BLOB_SIZE) || defined(FDB_TSDB_USING_SEQ_MODE) uint32_t tsl_index_in_sector; uint32_t sector_addr; - tsl->log_len = FDB_TSDB_FIXED_BLOB_SIZE; sector_addr = FDB_ALIGN_DOWN(tsl->addr.index, db_sec_size(db)); tsl_index_in_sector = (tsl->addr.index - sector_addr - SECTOR_HDR_DATA_SIZE) / LOG_IDX_DATA_SIZE; - tsl->addr.log = sector_addr + db_sec_size(db) - (tsl_index_in_sector + 1) * FDB_WG_ALIGN(FDB_TSDB_FIXED_BLOB_SIZE); +#endif + +#ifdef FDB_TSDB_USING_SEQ_MODE + /* Calculate time based on sector start time + index position */ + tsl->time = tsl->time + tsl_index_in_sector; +#else tsl->time = idx.time; +#endif + +#ifdef FDB_TSDB_FIXED_BLOB_SIZE + tsl->log_len = FDB_TSDB_FIXED_BLOB_SIZE; + tsl->addr.log = sector_addr + db_sec_size(db) - (tsl_index_in_sector + 1) * FDB_WG_ALIGN(FDB_TSDB_FIXED_BLOB_SIZE); #else tsl->log_len = idx.log_len; tsl->addr.log = idx.log_addr; - tsl->time = idx.time; #endif } @@ -326,12 +342,23 @@ static fdb_err_t write_tsl(fdb_tsdb_t db, fdb_blob_t blob, fdb_time_t time) idx.log_addr = log_addr; idx.log_len = blob->size; #endif +#ifdef FDB_TSDB_USING_SEQ_MODE + (void)time; +#else idx.time = time; +#endif /* write the status will by write granularity */ _FDB_WRITE_STATUS(db, idx_addr, idx.status_table, FDB_TSL_STATUS_NUM, FDB_TSL_PRE_WRITE, false); /* write other index info */ +#ifndef FDB_TSDB_USING_SEQ_MODE FLASH_WRITE(db, idx_addr + LOG_IDX_TS_OFFSET, &idx.time, sizeof(struct log_idx_data) - LOG_IDX_TS_OFFSET, false); +#else +#ifndef FDB_TSDB_FIXED_BLOB_SIZE + FLASH_WRITE(db, idx_addr + LOG_IDX_TS_OFFSET, &idx.log_len, sizeof(struct log_idx_data) - LOG_IDX_TS_OFFSET, false); +#endif +// #else no other index info +#endif /* write blob data */ FLASH_WRITE(db, log_addr, blob->buf, blob->size, false); /* write the status will by write granularity */ @@ -404,7 +431,11 @@ static fdb_err_t update_sec_status(fdb_tsdb_t db, tsdb_sec_info_t sector, fdb_bl static fdb_err_t tsl_append(fdb_tsdb_t db, fdb_blob_t blob, fdb_time_t *timestamp) { fdb_err_t result = FDB_NO_ERR; - fdb_time_t cur_time = timestamp == NULL ? db->get_time() : *timestamp; + fdb_time_t cur_time = timestamp == NULL ? db->get_time(db) : *timestamp; +#ifdef FDB_TSDB_USING_SEQ_MODE + /* should never have a timestamp in sequential mode */ + FDB_ASSERT(!timestamp) +#endif #ifdef FDB_TSDB_FIXED_BLOB_SIZE if (blob->size != FDB_TSDB_FIXED_BLOB_SIZE) { @@ -537,6 +568,9 @@ void fdb_tsl_iter(fdb_tsdb_t db, fdb_tsl_cb cb, void *arg) tsl.addr.index = sector.addr + SECTOR_HDR_DATA_SIZE; /* search all TSL */ do { +#ifdef FDB_TSDB_USING_SEQ_MODE + tsl.time = sector.start_time; +#endif read_tsl(db, &tsl); /* iterator is interrupted when callback return true */ if (cb(&tsl, arg)) { @@ -587,6 +621,9 @@ void fdb_tsl_iter_reverse(fdb_tsdb_t db, fdb_tsl_cb cb, void *cb_arg) tsl.addr.index = sector.end_idx; /* search all TSL */ do { +#ifdef FDB_TSDB_USING_SEQ_MODE + tsl.time = sector.start_time; +#endif read_tsl(db, &tsl); /* iterator is interrupted when callback return true */ if (cb(&tsl, cb_arg)) { @@ -604,11 +641,18 @@ void fdb_tsl_iter_reverse(fdb_tsdb_t db, fdb_tsl_cb cb, void *cb_arg) /* * Found the matched TSL address. */ -static int search_start_tsl_addr(fdb_tsdb_t db, int start, int end, fdb_time_t from, fdb_time_t to) +static int search_start_tsl_addr(fdb_tsdb_t db, int start, int end, fdb_time_t from, fdb_time_t to +#ifdef FDB_TSDB_USING_SEQ_MODE + ,fdb_time_t start_time +#endif +) { struct fdb_tsl tsl; while (true) { tsl.addr.index = start + FDB_ALIGN((end - start) / 2, LOG_IDX_DATA_SIZE); +#ifdef FDB_TSDB_USING_SEQ_MODE + tsl.time = start_time; +#endif read_tsl(db, &tsl); if (tsl.time < from) { start = tsl.addr.index + LOG_IDX_DATA_SIZE; @@ -621,6 +665,9 @@ static int search_start_tsl_addr(fdb_tsdb_t db, int start, int end, fdb_time_t f if (start > end) { if (from > to) { tsl.addr.index = start; +#ifdef FDB_TSDB_USING_SEQ_MODE + tsl.time = start_time; +#endif read_tsl(db, &tsl); if (tsl.time > from) { start -= LOG_IDX_DATA_SIZE; @@ -695,9 +742,16 @@ void fdb_tsl_iter_by_time(fdb_tsdb_t db, fdb_time_t from, fdb_time_t to, fdb_tsl found_start_tsl = true; /* search the first start TSL address */ - tsl.addr.index = search_start_tsl_addr(db, start, end, from, to); + tsl.addr.index = search_start_tsl_addr(db, start, end, from, to +#ifdef FDB_TSDB_USING_SEQ_MODE + , sector.start_time +#endif + ); /* search all TSL */ do { +#ifdef FDB_TSDB_USING_SEQ_MODE + tsl.time = sector.start_time; +#endif read_tsl(db, &tsl); if (tsl.status != FDB_TSL_UNUSED) { if ((from <= to && tsl.time >= from && tsl.time <= to) @@ -952,7 +1006,10 @@ fdb_err_t fdb_tsdb_init(fdb_tsdb_t db, const char *name, const char *path, fdb_g struct tsdb_sec_info sector; struct check_sec_hdr_cb_args check_sec_arg = { db, false, 0, 0}; - FDB_ASSERT(get_time); +#ifdef FDB_TSDB_USING_SEQ_MODE + /* In sequential mode cannot set get_time function */ + FDB_ASSERT(!get_time); +#endif result = _fdb_init_ex((fdb_db_t)db, name, path, FDB_DB_TYPE_TS, user_data); if (result != FDB_NO_ERR) { @@ -962,7 +1019,7 @@ fdb_err_t fdb_tsdb_init(fdb_tsdb_t db, const char *name, const char *path, fdb_g /* lock the TSDB */ db_lock(db); - db->get_time = get_time; + db->get_time = get_time == NULL ? fdb_default_get_time : get_time; db->max_len = max_len; /* default rollover flag is true */ db->rollover = true; @@ -1046,4 +1103,16 @@ fdb_err_t fdb_tsdb_deinit(fdb_tsdb_t db) return FDB_NO_ERR; } +/** + * The time series database default get time. + * default mode is sequential mode - returns last_time + 1 + * @param db database object + * + * @return fdb_time_t + */ +static fdb_time_t fdb_default_get_time(fdb_tsdb_t db) +{ + return db->last_time + 1; +} + #endif /* defined(FDB_USING_TSDB) */ diff --git a/tests/fdb_tsdb_tc.c b/tests/fdb_tsdb_tc.c index 9c4492c..8f04629 100644 --- a/tests/fdb_tsdb_tc.c +++ b/tests/fdb_tsdb_tc.c @@ -45,8 +45,10 @@ static int cur_times = 0; static struct test_tls_sector test_secs_info[10]; static fdb_time_t test_db_start_time = 0x7FFFFFFF, test_db_end_time = 0; -static fdb_time_t get_time(void) +static fdb_time_t get_time(fdb_tsdb_t db) { + /* db not used to get time */ + (void)db; cur_times += TEST_TIME_STEP; return cur_times; }