21 #include "data_sync_common.h" 22 #include "libsyncml/syncml_internals.h" 23 #include "libsyncml/sml_error_internals.h" 25 #include "data_sync_devinf.h" 27 SmlBool smlDataSyncIsTimestamp(
const char *anchor, SmlBool timestampDefault)
29 smlTrace(TRACE_ENTRY,
"%s(%s, %d)", __func__, VA_STRING(anchor), timestampDefault);
30 if (anchor == NULL || strlen(anchor) < 1)
33 smlTrace(TRACE_EXIT,
"%s - default", __func__);
34 return timestampDefault;
37 if (strstr(anchor,
"Z")) {
39 smlTrace(TRACE_EXIT,
"%s - TRUE", __func__);
43 smlTrace(TRACE_EXIT,
"%s - FALSE", __func__);
49 char *smlDataSyncGetNextAnchor(
54 smlTrace(TRACE_ENTRY,
"%s(%s)", __func__, VA_STRING(last));
56 SmlBool use_timestamp = TRUE;
59 use_timestamp = smlDataSyncIsTimestamp(last,
60 datastore->dsObject->useTimestampAnchor);
61 smlTrace(TRACE_INTERNAL,
"%s: use timestamp is %d", __func__, use_timestamp);
67 "%s: session %p, localtime %d, remoteDevInf %p",
69 datastore->dsObject->session,
70 datastore->dsObject->onlyLocaltime,
71 datastore->dsObject->remoteDevInf);
72 if (datastore->dsObject->session &&
73 !datastore->dsObject->onlyLocaltime &&
74 !datastore->dsObject->remoteDevInf &&
75 !smlDataSyncManageDevInf(datastore->dsObject, FALSE, error))
82 time_t htime = time(NULL);
83 if (datastore->dsObject->onlyLocaltime) {
84 smlTrace(TRACE_INTERNAL,
"%s: use localtime", __func__);
85 strftime(next, 17,
"%Y%m%dT%H%M%SZ", localtime(&htime));
87 smlTrace(TRACE_INTERNAL,
"%s: use UTC", __func__);
88 strftime(next, 17,
"%Y%m%dT%H%M%SZ", gmtime(&htime));
95 unsigned long count = strtoul(last, NULL, 10);
97 next = g_strdup_printf(
"%lu", count);
100 smlTrace(TRACE_EXIT,
"%s(%s)", __func__, VA_STRING(next));
This object represents an OMA DS datastore.
const char * smlErrorPrint(SmlError **error)
Returns the message of the error.
void smlTrace(SmlTraceType type, const char *message,...)
Used for tracing the application.
void * smlTryMalloc0(long n_bytes, SmlError **error)
Safely mallocs.