From owner-freebsd-questions@freebsd.org Sun Nov 3 16:28:43 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04C3817969D for ; Sun, 3 Nov 2019 16:28:43 +0000 (UTC) (envelope-from trond.endrestol@ximalas.info) Received: from enterprise.ximalas.info (enterprise.ximalas.info [IPv6:2001:700:1100:1::8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "ximalas.info", Issuer "Hostmaster ximalas.info" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 475hFP475Pz4KFc for ; Sun, 3 Nov 2019 16:28:40 +0000 (UTC) (envelope-from trond.endrestol@ximalas.info) Received: from enterprise.ximalas.info (Ximalas@localhost [127.0.0.1]) by enterprise.ximalas.info (8.15.2/8.15.2) with ESMTPS id xA3GSSUk010701 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Sun, 3 Nov 2019 17:28:28 +0100 (CET) (envelope-from trond.endrestol@ximalas.info) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ximalas.info; s=default; t=1572798508; bh=4VkNfhfd7aMPmE7K93vcaP/jigYbMEMBtZ7Oq908IEQ=; h=Date:From:To:Subject:In-Reply-To:References; b=K7avIUBRBVMvUoqmCq+pfl3iroJjFteIsCLknKCq5U1+qxFhdM5G6vSJx6feQlNwY wdRFugtCRZV1S4h3FsW+dgeCe3AWYrqq0/HSiurHq/v+zNPVvU0g9JbS1dCyd1+2OM 6HIuwbt2BcA8fj4xC1Mpc2CKKbz7mT3c2fXrY/R36ke8j5yc/UTuqgtAqYaHIks/gv EsEUXqlDwtax9w8XzVLcXEKh1lcJGUO25SIbnj2iB7X86VpL7kgwwEsq9T8STtU2nU PJv1XWJt7JssTgjC7iURHWSDi6/rFTNl244aYQba7Tj21dPW2M7tu/J9V/UBuG1vvb Qn6bqWLfzuC+g== Received: from localhost (trond@localhost) by enterprise.ximalas.info (8.15.2/8.15.2/Submit) with ESMTP id xA3GSScN010604 for ; Sun, 3 Nov 2019 17:28:28 +0100 (CET) (envelope-from trond.endrestol@ximalas.info) X-Authentication-Warning: enterprise.ximalas.info: trond owned process doing -bs Date: Sun, 3 Nov 2019 17:28:28 +0100 (CET) From: =?UTF-8?Q?Trond_Endrest=C3=B8l?= Sender: Trond.Endrestol@ximalas.info To: freebsd-questions@freebsd.org Subject: Re: How to convert svn repository change date to epoch timestamp? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21.99999 (BSF 352 2019-06-22) OpenPGP: url=http://ximalas.info/about/tronds-openpgp-public-key MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on enterprise.ximalas.info X-Rspamd-Queue-Id: 475hFP475Pz4KFc X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ximalas.info header.s=default header.b=K7avIUBR; dmarc=pass (policy=none) header.from=ximalas.info; spf=pass (mx1.freebsd.org: domain of trond.endrestol@ximalas.info designates 2001:700:1100:1::8 as permitted sender) smtp.mailfrom=trond.endrestol@ximalas.info X-Spamd-Result: default: False [-3.94 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[ximalas.info:s=default]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[ximalas.info:+]; DMARC_POLICY_ALLOW(-0.50)[ximalas.info,none]; IP_SCORE(-1.94)[ip: (-7.85), ipnet: 2001:700::/32(-1.19), asn: 224(-0.64), country: NO(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:224, ipnet:2001:700::/32, country:NO]; RCVD_TLS_LAST(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2019 16:28:43 -0000 On Sun, 3 Nov 2019 13:03+0100, mj-mailinglist@gmx.de wrote: > I am trying to convert the output of this command > > svnlite info --show-item last-changed-date /usr/src/ > > to an epoch timestamp with base tools. > > The output looks like this: 2019-11-03T07:11:09.005639Z > > The date man page gives this example for converting dates: > > date -j -f "%a %b %d %T %Z %Y" "`date`" "+%s" > (maybe add the info, that you have to use LC_TIME=C for this example to work) > > I came up with this date format string "%Y-%m-%dT%H:%M:%SZ" but this > lacks the fractions part of the seconds. > > Is this possible with the tools in base? > > Or maybe i could chop of the second-fractions? Try this: date -juf "%FT%TZ" `svnlite info --no-newline --show-item last-changed-date /usr/src | sed 's/\.[0-9]*Z$/Z/'` "+%s" -- Trond.