From edaaf87e7d03191d5ba37b24266960ce89ab317e Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 9 Feb 2014 14:15:40 +0000 Subject: [PATCH] Improved output of -pvd_info with timestamps with non-zero time zone --- xorriso/iso_img.c | 34 +++++++++++++++++++++++++--------- xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/xorriso/iso_img.c b/xorriso/iso_img.c index c4fcaabc..32f6fa46 100644 --- a/xorriso/iso_img.c +++ b/xorriso/iso_img.c @@ -271,6 +271,27 @@ static const char *un0(const char *text) } +static int Xorriso_report_pvd_time(struct XorrisO *xorriso, char *head, + char *pvd_time, int flag) +{ + char *msg, hr[17]; + int at; + + msg= xorriso->result_line; + strncpy(hr, pvd_time, 16); + hr[16]= 0; + sprintf(msg, "%s %s\n", head, hr); + Xorriso_result(xorriso,0); + if(pvd_time[16] != 0) { + at= abs(pvd_time[16]); + sprintf(msg, "%2.2s. Time Zone: %c%-2.2d:%-2.2d\n", head, + pvd_time[16] > 0 ? '+' : '-', at / 4, (at - (at / 4) * 4) * 15); + Xorriso_result(xorriso,0); + } + return(1); +} + + int Xorriso_pvd_info(struct XorrisO *xorriso, int flag) { int ret, msc1= -1, msc2, i; @@ -330,15 +351,10 @@ int Xorriso_pvd_info(struct XorrisO *xorriso, int flag) ret= iso_image_get_pvd_times(image, &crt, &mdt, &ext, &eft); if(ret != ISO_SUCCESS) crt= mdt= ext= eft= ""; - sprintf(msg, "Creation Time: %s\n", crt); - Xorriso_result(xorriso,0); - sprintf(msg, "Modif. Time : %s\n", mdt); - Xorriso_result(xorriso,0); - sprintf(msg, "Expir. Time : %s\n", ext); - Xorriso_result(xorriso,0); - sprintf(msg, "Eff. Time : %s\n", eft); - Xorriso_result(xorriso,0); - + Xorriso_report_pvd_time(xorriso, "Creation Time:", crt, 0); + Xorriso_report_pvd_time(xorriso, "Modif. Time :", mdt, 0); + Xorriso_report_pvd_time(xorriso, "Expir. Time :", ext, 0); + Xorriso_report_pvd_time(xorriso, "Eff. Time :", eft, 0); return(1); } diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 57f0fa34..2ed6875c 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2014.02.08.111505" +#define Xorriso_timestamP "2014.02.09.141412"