From owner-freebsd-questions@freebsd.org Sun Nov 3 14:00:17 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 3D9D61B5CD9 for ; Sun, 3 Nov 2019 14:00:17 +0000 (UTC) (envelope-from kremels@kreme.com) Received: from mail.covisp.net (mail.covisp.net [65.121.55.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 475cy80XBJz49V5 for ; Sun, 3 Nov 2019 14:00:15 +0000 (UTC) (envelope-from kremels@kreme.com) Content-Type: text/plain; charset=utf-8 Subject: Re: How to convert svn repository change date to epoch timestamp? From: "@lbutlr" X-Priority: 3 In-Reply-To: Date: Sun, 3 Nov 2019 07:00:12 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <842662CC-EF20-43D8-8D1B-593D598D41FF@kreme.com> References: To: FreeBSD X-Mailer: Apple Mail (2.3601.0.10) X-Rspamd-Queue-Id: 475cy80XBJz49V5 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of kremels@kreme.com designates 65.121.55.42 as permitted sender) smtp.mailfrom=kremels@kreme.com X-Spamd-Result: default: False [1.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.96)[-0.964,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MISSING_MIME_VERSION(2.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[kreme.com]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.44)[-0.437,0]; IP_SCORE(-0.20)[ip: (-0.74), ipnet: 65.112.0.0/12(-0.20), asn: 209(-0.02), country: US(-0.05)]; TO_DN_ALL(0.00)[]; HAS_X_PRIO_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; RCVD_IN_DNSWL_LOW(-0.10)[42.55.121.65.list.dnswl.org : 127.0.5.1]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:209, ipnet:65.112.0.0/12, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_EQ_ENVFROM(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 14:00:17 -0000 On 03 Nov 2019, at 05:03, mj-mailinglist@gmx.de wrote: > Hi, >=20 > I am trying to convert the output of this command >=20 > svnlite info --show-item last-changed-date /usr/src/ >=20 > to an epoch timestamp with base tools. >=20 > The output looks like this: 2019-11-03T07:11:09.005639Z That seems very close to the gnu date output for ns: # gdate -Ins 2019-11-03T06:50:24,239481325-07:00 # gdate -Iseconds 2019-11-03T06:50:24-07:00 > The date man page gives this example for converting dates: >=20 > date -j -f "%a %b %d %T %Z %Y" "`date`" "+%s" > (maybe add the info, that you have to use LC_TIME=3DC for this example = to work) >=20 > I came up with this date format string "%Y-%m-%dT%H:%M:%SZ" but this > lacks the fractions part of the seconds. If you have gnu date you=20 # gdate --utc +"%Y-%m-%dT%H:%M:%S.%N=E2=80=9D 2019-11-03T13:59:27.977839613 To get current UTC time in the format you want. --=20 Knowledge equals power... --... Power equals energy... People were stupid, sometimes. They thought the Library was a dangerous place because of all the magical books, which was true enough, but what made it really one of the most dangerous places there could ever be was the simple fact that it was a library. Energy equals matter... --... Matter equals mass. And mass distorts space. It distorts it into polyfractal L-Space. --Guards! Guards!