X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Fstats-tool.c;h=105dc4973edb65f4dae58c1a45207bb437bfc015;hb=7ef7e96fc2f3eb620fffb6f277339214efe83747;hp=7d117fdcb669a3465afd4deb8b1ca8775f9ba2a2;hpb=bcae74da8fa2958b3fec9153fc33e41f0e0317bf;p=platform%2Fupstream%2Fconnman.git diff --git a/tools/stats-tool.c b/tools/stats-tool.c old mode 100644 new mode 100755 index 7d117fd..105dc49 --- a/tools/stats-tool.c +++ b/tools/stats-tool.c @@ -22,7 +22,6 @@ #include #endif -#define _GNU_SOURCE #include #include #include @@ -109,12 +108,10 @@ static char *option_last_file_name = NULL; static bool parse_start_ts(const char *key, const char *value, gpointer user_data, GError **error) { - GTimeVal time_val; + struct tm tm; - if (!g_time_val_from_iso8601(value, &time_val)) - return false; - - option_start_ts = time_val.tv_sec; + strptime(value, "%FT%TZ", &tm); + option_start_ts = mktime(&tm); return true; } @@ -794,7 +791,7 @@ static void swap_and_close_files(struct stats_file *history_file, munmap(history_file->addr, history_file->len); munmap(temp_file->addr, temp_file->len); - TFR(close(temp_file->fd)); + close(temp_file->fd); unlink(history_file->name); @@ -802,7 +799,7 @@ static void swap_and_close_files(struct stats_file *history_file, return; unlink(temp_file->name); - TFR(close(history_file->fd)); + close(history_file->fd); } static void history_file_update(struct stats_file *data_file, @@ -885,6 +882,11 @@ int main(int argc, char *argv[]) else start_ts = option_start_ts; + if (option_interval == 0) { + printf("interval cannot be zero, using the default value\n"); + option_interval = 3; + } + if (option_create > 0) stats_create(data_file, option_create, option_interval, start_ts, rec);