2011-11-23, 12:00(-05), Chet Ramey: > On 11/22/11 4:53 PM, Greg Wooledge wrote: >> This is a feature request, rather than a bug. Bash 4.2's printf command >> has a lovely %(datefmt)T feature that allows it to print out formatted >> timestamps using the underlying operating system's strftime(3) routine. >> It even allows bash to print the current time, or the time the current >> shell was invoked. > > I wonder if a better way to handle this is to require the %s expansion > at configure time and use the strftime replacement in lib/sh if the C > library's strftime doesn't implement it. What systems, if you know, do > not handle %s? [...]
Or just have a special variable for that like zsh's $EPOCHSECONDS. Note that GNU strftime has more extensions than just %s. See also http://stchaz.free.fr/wide_strftime for a POSIX shell implementation of strftime (limited to GMT timezone and POSIX locale though). -- Stephane