Modify time measure & some error on config.c 18/181118/2
authorjunkyu han <junkyu.han@samsung.com>
Fri, 8 Jun 2018 08:08:22 +0000 (17:08 +0900)
committerJeonghoon Park <jh1979.park@samsung.com>
Mon, 11 Jun 2018 04:50:06 +0000 (04:50 +0000)
Change-Id: Ia00bbd3478c01ff1ac657a83628215c57133cf51

common/common-util.h
daemon/include/ttd-config.h
daemon/src/tizen-things-daemon.c
daemon/src/ttd-config.c

index 22c0489..959eaed 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <time.h>
 
-#define EPOCH_TIME_REF 1526515200000000 /* 2018-05-17 GMT */
+#define EPOCH_TIME_REF 1526515200 /* 2018-05-17 GMT */
 
 long long common_get_monotonic_time(void);
 long long common_get_monotonic_coarse_time(void);
index 08eeb61..39f8857 100644 (file)
@@ -18,7 +18,6 @@
 #define __TT_DAEMON_CONFIG_H__
 
 #include <stdbool.h>
-#include "ttd-cmd.h"
 
 #define CONFIG_PATH_MAX 1024
 
@@ -32,7 +31,7 @@ int ttd_config_write_integer(const char *group, const char *key, int value);
 int ttd_config_write_boolean(const char *group, const char *key, bool value);
 int ttd_config_write_string(const char *group, const char *key, const char *value);
 int ttd_config_remove_group(const char *group);
-int tt_config_remove_key(const char *group, const char *key);
+int ttd_config_remove_key(const char *group, const char *key);
 
 #endif /* __TT_DAEMON_CONFIG_H__ */
 
index 08e6109..104da1f 100644 (file)
@@ -261,9 +261,9 @@ static void __time_changed(keynode_t *node, void *data)
 
        current_time = common_get_epoch_time();
 
-       if ((current_time * 1000000) > EPOCH_TIME_REF && !d_data->is_time_set) {
+       if (current_time > EPOCH_TIME_REF && !d_data->is_time_set) {
                /* Do something need correct time after here */
-               _D("We assume that system time is correct, because current[%lld] is bigger than 2018-05-17", current_time * 1000000);
+               _D("We assume that system time is correct, because current[%lld] is bigger than 2018-05-17", current_time);
                d_data->is_time_set = true;
                g_idle_add(__do_device_register, d_data);
        }
@@ -286,17 +286,13 @@ int main(int argc, char* argv[])
        g_unix_signal_add(SIGINT, _handle_sigint, d_data);
        g_unix_signal_add(SIGTERM, _handle_sigterm, d_data);
 
-       if (vconf_notify_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, __time_changed, d_data) < 0) {
-               _E("Failed to set vconf key changed");
-       }
+       vconf_notify_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, __time_changed, d_data);
 
        ttd_queue_init();
        ttd_conn_mgr_init();
        ttd_http_init();
        ttd_cloud_conn_state_set(TTD_CLOUD_CONN_STATE_DISCONNECTED);
-
-       if (ttd_worker_interface_init(&(d_data->worker_itf_h)) < 0)
-               _E("Failed to initialize worker interface");
+       ttd_worker_interface_init(&(d_data->worker_itf_h));
 
        d_data->thread_pool =
                g_thread_pool_new(__main_thread_pool_func, d_data, -1, FALSE, NULL);
index f3d2d3d..699c7cf 100644 (file)
@@ -67,7 +67,7 @@ int ttd_config_read_integer(const char *group, const char *key, int *value)
        }
 
        ret = g_key_file_get_integer(gkf, group, key, &error);
-       if (!error) {
+       if (error) {
                _E("Failed to get integer[%s]", error->message);
                g_error_free(error);
                return -1;
@@ -94,7 +94,7 @@ int ttd_config_read_boolean(const char *group, const char *key, bool *value)
        }
 
        ret = g_key_file_get_boolean(gkf, group, key, &error);
-       if (!ret) {
+       if (error) {
                _E("Failed to get boolean[%s]", error->message);
                g_error_free(error);
                return -1;
@@ -121,7 +121,7 @@ int ttd_config_read_string(const char *group, const char *key, char **value)
        }
 
        ret = g_key_file_get_string(gkf, group, key, &error);
-       if (!ret) {
+       if (error) {
                _E("Failed to get string[%s]", error->message);
                g_error_free(error);
                return -1;
@@ -150,7 +150,7 @@ int ttd_config_write_integer(const char *group, const char *key, int value)
        return 0;
 }
 
-int ttd_config_write_bool(const char *group, const char *key, bool value)
+int ttd_config_write_boolean(const char *group, const char *key, bool value)
 {
        retv_if(!group, -1);
        retv_if(!key, -1);