Skip to content

Commit b256d10

Browse files
committed
Update C API [5.3.0 -> 5.3.1]
1 parent 668e72a commit b256d10

3 files changed

Lines changed: 50 additions & 4 deletions

File tree

objectbox/lib/src/native/bindings/objectbox-sync.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2025 ObjectBox Ltd. All rights reserved.
2+
* Copyright 2018-2026 ObjectBox Ltd. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@
3434
#include "objectbox.h"
3535

3636
#if defined(static_assert) || defined(__cplusplus)
37-
static_assert(OBX_VERSION_MAJOR == 5 && OBX_VERSION_MINOR == 3 && OBX_VERSION_PATCH == 0, // NOLINT
37+
static_assert(OBX_VERSION_MAJOR == 5 && OBX_VERSION_MINOR == 3 && OBX_VERSION_PATCH == 1, // NOLINT
3838
"Versions of objectbox.h and objectbox-sync.h files do not match, please update");
3939
#endif
4040

@@ -1098,6 +1098,19 @@ OBX_C_API obx_err obx_custom_msg_client_set_state(uint64_t client_id, OBXCustomM
10981098
/// @returns OBX_ERROR_* in case the operation encountered an exceptional issue
10991099
OBX_C_API obx_err obx_custom_msg_client_trigger_reconnect(uint64_t client_id);
11001100

1101+
//---------------------------------------------------------------------------
1102+
// Misc (e.g. Sync clock)
1103+
//---------------------------------------------------------------------------
1104+
1105+
/// Gets the "raw" timestamp (milliseconds since epoch) from the given sync clock value.
1106+
/// Note that sync clock values are assigned by ObjectBox and are not to be interpreted on their own.
1107+
OBX_C_API int64_t obx_sync_clock_timestamp(uint64_t sync_clock_value);
1108+
1109+
/// Gets the corrected timestamp (milliseconds since epoch) from the given sync clock value.
1110+
/// Like obx_cync_clock_timestamp(), but applies any time correction if present in the sync clock value.
1111+
/// However, for most cases, it will return the same value as obx_cync_clock_timestamp().
1112+
OBX_C_API int64_t obx_sync_clock_timestamp_corrected(uint64_t sync_clock_value);
1113+
11011114
// NOLINTEND(modernize-use-using)
11021115

11031116
#ifdef __cplusplus

objectbox/lib/src/native/bindings/objectbox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extern "C" {
5353
/// obx_version() or obx_version_is_at_least().
5454
#define OBX_VERSION_MAJOR 5
5555
#define OBX_VERSION_MINOR 3
56-
#define OBX_VERSION_PATCH 0 // values >= 100 are reserved for dev releases leading to the next minor/major increase
56+
#define OBX_VERSION_PATCH 1 // values >= 100 are reserved for dev releases leading to the next minor/major increase
5757

5858
//----------------------------------------------
5959
// Common types

objectbox/lib/src/native/bindings/objectbox_c.dart

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10246,6 +10246,39 @@ class ObjectBoxC {
1024610246
late final _custom_msg_client_trigger_reconnect =
1024710247
_custom_msg_client_trigger_reconnectPtr.asFunction<int Function(int)>();
1024810248

10249+
/// Gets the "raw" timestamp (milliseconds since epoch) from the given sync clock value.
10250+
/// Note that sync clock values are assigned by ObjectBox and are not to be interpreted on their own.
10251+
int sync_clock_timestamp(
10252+
int sync_clock_value,
10253+
) {
10254+
return _sync_clock_timestamp(
10255+
sync_clock_value,
10256+
);
10257+
}
10258+
10259+
late final _sync_clock_timestampPtr =
10260+
_lookup<ffi.NativeFunction<ffi.Int64 Function(ffi.Uint64)>>(
10261+
'obx_sync_clock_timestamp');
10262+
late final _sync_clock_timestamp =
10263+
_sync_clock_timestampPtr.asFunction<int Function(int)>();
10264+
10265+
/// Gets the corrected timestamp (milliseconds since epoch) from the given sync clock value.
10266+
/// Like obx_cync_clock_timestamp(), but applies any time correction if present in the sync clock value.
10267+
/// However, for most cases, it will return the same value as obx_cync_clock_timestamp().
10268+
int sync_clock_timestamp_corrected(
10269+
int sync_clock_value,
10270+
) {
10271+
return _sync_clock_timestamp_corrected(
10272+
sync_clock_value,
10273+
);
10274+
}
10275+
10276+
late final _sync_clock_timestamp_correctedPtr =
10277+
_lookup<ffi.NativeFunction<ffi.Int64 Function(ffi.Uint64)>>(
10278+
'obx_sync_clock_timestamp_corrected');
10279+
late final _sync_clock_timestamp_corrected =
10280+
_sync_clock_timestamp_correctedPtr.asFunction<int Function(int)>();
10281+
1024910282
/// Initializes Dart API - call before any other obx_dart_* functions.
1025010283
int dartc_init_api(
1025110284
ffi.Pointer<ffi.Void> data,
@@ -12031,7 +12064,7 @@ const int OBX_VERSION_MAJOR = 5;
1203112064

1203212065
const int OBX_VERSION_MINOR = 3;
1203312066

12034-
const int OBX_VERSION_PATCH = 0;
12067+
const int OBX_VERSION_PATCH = 1;
1203512068

1203612069
const int OBX_ID_NEW = -1;
1203712070

0 commit comments

Comments
 (0)