#include <config.h>
#endif
-#define _GNU_SOURCE
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
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;
}
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);
return;
unlink(temp_file->name);
- TFR(close(history_file->fd));
+ close(history_file->fd);
}
static void history_file_update(struct stats_file *data_file,
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);