diff options
author | Dario Lombardo <lomato@gmail.com> | 2018-12-25 21:51:54 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2018-12-26 10:41:23 +0000 |
commit | 796dca3c2a5259af62d89519193308d71774c2a9 (patch) | |
tree | 10d965f7d1ddce06607509a4aff0683bfa11862a /epan/print.c | |
parent | 7ec16dc50d891ba481d293e282935c4c8e116d46 (diff) |
print: use frame date instead of current for json index.
Instead of using the current date (that can differ from packets)
take if from the current frame. That will put the frame in an index
related to its capture date instead of its loading date.
Small indentation fixes.
Change-Id: If9f9dad1399c2b1bf145e8bcc45a6936e4599cd7
Reviewed-on: https://code.wireshark.org/review/31204
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/print.c')
-rw-r--r-- | epan/print.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/epan/print.c b/epan/print.c index 7aa0c75285..473134e845 100644 --- a/epan/print.c +++ b/epan/print.c @@ -351,14 +351,13 @@ write_ek_proto_tree(output_fields_t* fields, { write_json_data data; char ts[30]; - time_t t = time(NULL); - struct tm *timeinfo; + struct tm *timeinfo; g_assert(edt); g_assert(fh); /* Create the output */ - timeinfo = localtime(&t); + timeinfo = localtime(&edt->pi.abs_ts.secs); if (timeinfo != NULL) strftime(ts, sizeof ts, "%Y-%m-%d", timeinfo); else @@ -700,8 +699,7 @@ write_json_proto_tree(output_fields_t* fields, FILE *fh) { char ts[30]; - time_t t = time(NULL); - struct tm * timeinfo; + struct tm *timeinfo; write_json_data data; if (!json_is_first) { @@ -710,7 +708,7 @@ write_json_proto_tree(output_fields_t* fields, json_is_first = FALSE; } - timeinfo = localtime(&t); + timeinfo = localtime(&edt->pi.abs_ts.secs); if (timeinfo != NULL) { strftime(ts, sizeof ts, "%Y-%m-%d", timeinfo); } else { |