strftime: new date formatting utility that supports git-style tz offsets
commitf73b6b2b6ed849c5259c93b7c08a81020126304c
authorKyle J. McKay <mackyle@gmail.com>
Tue, 7 Jun 2016 02:52:15 +0000 (6 19:52 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Tue, 7 Jun 2016 02:52:15 +0000 (6 19:52 -0700)
treeb14c53cdd187d288a47e748e3bdabda9f3a670ef
parent328b8319fa594bf4d34bed71cefd23d5911570ad
strftime: new date formatting utility that supports git-style tz offsets

Formatting a date that's represented in seconds-since-the-epoch from the
command line is problematic at best.  The option to the `date` command
to pass it the seconds-since-the-epoch value is platform-specific and
failing that the only platform-indpendent option is to run perl and then
do 'use POSIX qw(strftime)' which is a awful lot of overhead just to
format one date.

Add on to that the added difficulty of getting it to display in the
time zone indicated by an offset such as that recorded by Git and it
becomes even more of a burden.

Instead add a tiny, efficient, command-line utility 'strftime' that
provides access to strftime(3) for formatting seconds-since-the-epoch
values and understands how to make the result show in the time zone
indicated by the optional strftime(3)-%z-style argument.

An shlib.sh strftime function is added to make sure it's available
to all shlib.sh-including scripts without worrying about what the
current value of $PATH is.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
install.sh
shlib.sh
src/.gitignore
src/GNUmakefile
src/strftime.c [new file with mode: 0644]