Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV file output: fix for timestamp inaccuracy and Y-2038 problem #20

Merged
merged 1 commit into from
Jun 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ char *values2str(char mode,t_iface_speed_stats stats,t_iface_stats full_stats,fl
/* do the actual output */
void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_speed_stats stats,float multiplier,t_iface_stats full_stats) {
char buffer[50];
struct timeval now;
#if CSV || HTML
FILE *tmp_out_file;
#endif
Expand Down Expand Up @@ -540,7 +541,8 @@ void print_values(unsigned int y,unsigned int x,const char *if_name,t_iface_spee
#ifdef CSV
case CSV_OUT:
tmp_out_file=out_file==NULL ? stdout : out_file;
fprintf(tmp_out_file,"%i%c%s%c",(int)time(NULL),csv_char,if_name,csv_char);
gettimeofday(&now, NULL);
fprintf(tmp_out_file,"%1.6f%c%s%c",(((double)now.tv_sec * 1000000.0) + (double)now.tv_usec) / 1000000.0,csv_char,if_name,csv_char);
if (output_type == RATE_OUT || output_type == SUM_OUT) {
if (output_type == RATE_OUT) {
stats_csv = &stats;
Expand Down