Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Nov 2019 07:00:12 -0700
From:      "@lbutlr" <kremels@kreme.com>
To:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: How to convert svn repository change date to epoch timestamp?
Message-ID:  <842662CC-EF20-43D8-8D1B-593D598D41FF@kreme.com>
In-Reply-To: <trinity-0e118d1a-6b7c-4c5e-a0b8-2b6fceb1e713-1572782605441@3c-app-gmx-bs36>
References:  <trinity-0e118d1a-6b7c-4c5e-a0b8-2b6fceb1e713-1572782605441@3c-app-gmx-bs36>

next in thread | previous in thread | raw e-mail | index | archive | help
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!




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?842662CC-EF20-43D8-8D1B-593D598D41FF>