systime

Change-Id: Ibb0edbb28a8c5d7281b0f247124af1b984c3ac8e
diff --git a/mbtk/liblynq_lib/src/lynq_time.c b/mbtk/liblynq_lib/src/lynq_time.c
index a288c86..269527d 100644
--- a/mbtk/liblynq_lib/src/lynq_time.c
+++ b/mbtk/liblynq_lib/src/lynq_time.c
@@ -19,6 +19,7 @@
 #include "mbtk_net_control.h"
 #include "lynq_systime.h"
 #include "mbtk_type.h"
+#include "mbtk_log.h"
 
 
 #define MBTK_AT_NTP_LEN_MAX 128
@@ -57,7 +58,7 @@
 //int req_time_set(int type, char *time, int *cme_err);
 static int metis_strptime(char *str_time)
 {
-    printf("%s(), str_time:%s\n", __FUNCTION__, str_time);
+    LOGD("%s(), str_time:%s\n", __FUNCTION__, str_time);
     struct tm stm;
     char dateTime[30];
     struct timeval tv;
@@ -69,24 +70,24 @@
         tv.tv_usec = 0;	
         if(_t == -1)
         {
-            printf("Set time :%s", str_time);
-            printf("timestamp:%ld", _t);
-            printf("mktime error, reason: %s\n", strerror(errno));
+            LOGD("Set time :%s", str_time);
+            LOGD("timestamp:%ld", _t);
+            LOGD("mktime error, reason: %s\n", strerror(errno));
             return -1;
         }
 
         if(settimeofday(&tv, NULL)) {
-            printf("Set time :%s", str_time);
-            printf("timestamp:%ld", _t);
-            printf("mktime error, reason: %s\n", strerror(errno));
+            LOGD("Set time :%s", str_time);
+            LOGD("timestamp:%ld", _t);
+            LOGD("mktime error, reason: %s\n", strerror(errno));
             return -1;
         } 
 
-        printf("Success Set time to %s.\n", str_time);
+        LOGD("Success Set time to %s.\n", str_time);
         return 0;
 
     } else {
-        printf("Set time fail.");
+        LOGD("Set time fail.");
         return -1;
     }
     return 0;
@@ -97,14 +98,14 @@
 {
     if (mbtk_net_state_get() == MBTK_NET_STATE_OFF) 
     {
-        printf("Network is disconnected. Set time fail.");
+        LOGD("Network is disconnected. Set time fail.");
         if(NULL != ntp_flag)
        {
             *ntp_flag = -1;
        }
         return NULL;
     }
-    printf("Network is connected.");
+    LOGD("Network is connected.");
 
     char time_type[10];
     while(1){
@@ -116,7 +117,7 @@
             time_t time = 0;
             if((time = (time_t)mbtk_at_systime()) == 0) 
             {
-                printf("NTP client fail!\n");
+                LOGD("NTP client fail!\n");
                 if(NULL != ntp_flag)
                 {
                      *ntp_flag = -1;
@@ -131,7 +132,7 @@
             strftime(dateTime, 30, "%Y-%m-%d %H:%M:%S %A", &CurlocalTime);
 
       //      printf("dateTime:%s, %ld\n", dateTime, time+28800);  //cst
-            printf("dateTime:%s, %ld\n", dateTime, time);
+            LOGD("dateTime:%s, %ld\n", dateTime, time);
 
             struct timeval tv;
             tv.tv_sec = time;
@@ -139,16 +140,16 @@
             tv.tv_usec = 0;
 
             if(settimeofday(&tv, NULL)) {
-                printf("Set time :%s", dateTime);
-                printf("timestamp:%ld, tv.tv_sec:%ld\n", time, tv.tv_sec);
+                LOGD("Set time :%s", dateTime);
+                LOGD("timestamp:%ld, tv.tv_sec:%ld\n", time, tv.tv_sec);
 
                 if(settimeofday(&tv, NULL)) {
                     *ntp_flag = -1;
-                    printf("mktime error, reason: %s\n", strerror(errno));
+                    LOGD("mktime error, reason: %s\n", strerror(errno));
                     return NULL;
                 }
             } 
-            printf("Set time success\n");
+            LOGD("Set time success\n");
             lynq_set_rtc_time();
 #else
             
@@ -366,3 +367,4 @@
 }
 
 
+