bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: printf %(%s)T


From: Stephane CHAZELAS
Subject: Re: feature request: printf %(%s)T
Date: Wed, 23 Nov 2011 20:31:06 +0000 (UTC)
User-agent: slrn/pre1.0.0-18 (Linux)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]