allow use of TZ= environment variable - ics2txt - convert icalendar .ics file to plain text HTML git clone git://bitreich.org/ics2txt git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ics2txt DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 5a6d05cc7d0f248c84b7f22bd1262bd9fdc9e750 DIR parent 4bcfcc3e64d33c6e67b3f6f6359e859d2ee0ff6b HTML Author: Josuah Demangeon <me@josuah.net> Date: Sat, 19 Jun 2021 12:25:35 +0200 allow use of TZ= environment variable Diffstat: M ics2tsv.1 | 14 ++++++++++++-- M ics2tsv.c | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) --- DIR diff --git a/ics2tsv.1 b/ics2tsv.1 @@ -105,6 +105,17 @@ by default in seconds since 1970/01/01. .El . . +.Sh ENVIRONMENT VARIABLES +. +.Bl -tag +. +.It TZ +Timezone to use for printing dates, as documented by +.Xr tzset 3 . +. +.El +. +. .Sh EXAMPLES . Convert a calendar from HTTP @@ -128,11 +139,10 @@ ics2tsv -f CATEGORIES icalendar.ics | awk -F '\et' '{ print >>($6".tsv") }\' . .Sh SEE ALSO . -.Xr awk 1 , .Xr cal 1 , .Xr calendar 1 , .Xr date 1 , -.Xr sort 1 +.Xr tzset 3 . . .Sh STANDARDS DIR diff --git a/ics2tsv.c b/ics2tsv.c @@ -70,9 +70,9 @@ fn_block_end(IcalParser *p, char *name) if (flag_t == NULL) { printf("\t%lld\t%lld", block.beg, block.end); } else { - strftime(buf, sizeof buf, flag_t, gmtime_r(&block.beg, &tm)); + strftime(buf, sizeof buf, flag_t, localtime_r(&block.beg, &tm)); printf("\t%s", buf); - strftime(buf, sizeof buf, flag_t, gmtime_r(&block.end, &tm)); + strftime(buf, sizeof buf, flag_t, localtime_r(&block.end, &tm)); printf("\t%s", buf); }