OSDN Git Service

GPS時刻によるLinuxシステム時刻セット機能を追加
[scilog/scilog.git] / conf.c
diff --git a/conf.c b/conf.c
index 0cf3764..c26f16e 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -54,6 +54,19 @@ pthread_mutex_unlock(&mutex_conf);
        return f;
 }
 
+/**** Linux時刻セット ***************************************************
+*/
+// 1=ON
+static int linux_time_set;
+void conf_linux_time_set_set(int val)
+{
+       linux_time_set = val;
+}
+int conf_linux_time_set_get(void)
+{
+       return linux_time_set;
+}
+
 //
 /**** 設定ファイル *******************************************
 */
@@ -147,6 +160,7 @@ int conf_read(void)
        char    buf[256];
 //     char    buf2[256];
        int     f;
+       int     val;
        
        fp = fopen(CONF_FILE, "rt");
        if (fp == NULL) {
@@ -171,6 +185,11 @@ int conf_read(void)
                        conf_gain_set(f);
                        syslog(LOG_INFO, "gain=%d", conf_gain_get());
                } 
+               // Linux時刻セット
+               if (sscanf(buf, "linux_time_set = %d", &val) == 1) {
+                       conf_linux_time_set_set(val);
+                       syslog(LOG_INFO, "linux_time_set=%d", conf_linux_time_set_get());
+               } 
        }
        fclose(fp);
        return 0;