diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-01 15:21:05 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-03-03 13:46:39 +0100 |
commit | 54d3d976c71d45748fef267b5c35a49467e781c5 (patch) | |
tree | 649fbe54322f815090bc0f4970a2c09b43baae2f | |
parent | 3a0ef77305b179511aae6d8e5af05bbbebabee6b (diff) | |
download | lvm2-54d3d976c71d45748fef267b5c35a49467e781c5.tar.gz |
metadata: format_text: reuse _print_timestamp fn
-rw-r--r-- | lib/format_text/export.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/format_text/export.c b/lib/format_text/export.c index f17ccf574..c4c7b381e 100644 --- a/lib/format_text/export.c +++ b/lib/format_text/export.c @@ -675,8 +675,6 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv) struct lv_segment *seg; char buffer[4096]; int seg_count; - struct tm *local_tm; - time_t ts; uint64_t status = lv->status; outnl(f); @@ -705,16 +703,10 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv) return_0; if (lv->timestamp) { - ts = (time_t)lv->timestamp; - strncpy(buffer, "# ", sizeof(buffer)); - if (!(local_tm = localtime(&ts)) || - !strftime(buffer + 2, sizeof(buffer) - 2, - "%Y-%m-%d %T %z", local_tm)) - buffer[0] = 0; - + if (!_print_timestamp(f, "creation_time", lv->timestamp, + buffer, sizeof(buffer))) + return_0; outf(f, "creation_host = \"%s\"", lv->hostname); - outfc(f, buffer, "creation_time = %" PRIu64, - lv->timestamp); } if (lv->lock_args) |