delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/10/21/20:06:47

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=qig
BeFaGCYmuZ/BpjH6H7bel0SgGfW7lw3Hqrk4poZk29vE2N7DuYhPPnA8TV2oqpAk
W/erWttbzYYZ/csMrR9iqL6ajq2IamYdb5OuScLNbMla9ia1OkM4nAR+iJZ6Sen9
/rYaFvrhyEfdG6MWMbxo1ScKwxBZ7kjZ5oSqB3s8=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; s=default; bh=dc9WdUCr3
JiH93Zk02V0jI9YYVA=; b=oO6wBfiCTpELlbJJFgCaXaZ8Qu2FQrLg5NI6FnQPb
T4j5h+I0pwgqtvhxtNfa7G4dcbMs2eX+za0Uo2zh4AJYLKaou7j2DTe+czoCowVA
bZIfJTexFAIxEqfcOKuoTSQqpjrimxFsGS97zFuiNwNXtxZvHNChnqffEeq6butk
8U=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: plane.gmane.org
To: cygwin AT cygwin DOT com
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: Bash unable to print epoch timestamp
Date: Thu, 22 Oct 2015 00:05:53 +0000 (UTC)
Lines: 15
Message-ID: <loom.20151022T010214-951@post.gmane.org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes

Don Harrop <don <at> effx.us> writes:
> Bash outputs no value when using it's built in method of printing an 
> "epoch" timestamp.
> BashCommandLine#: printf '%(%s)T' -1

bash printf depends on underlying strftime in newlib, which does not support
%s, as it is conditional on _WANT_C99_TIME_FORMATS being defined, and that
is presumably not defined in the config, as %s is not shown in man strftime. 
Workaround for now is use 
    date +%s 
for current time, and 
   date -d $(printf '%(%T)T' -2) +%s
for shell invocation time.




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019