How to convert svn repository change date to epoch timestamp?
@lbutlr
kremels at kreme.com
Sun Nov 3 14:00:17 UTC 2019
On 03 Nov 2019, at 05:03, mj-mailinglist at gmx.de wrote:
> Hi,
>
> 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
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:
>
> 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.
If you have gnu date you
# gdate --utc +"%Y-%m-%dT%H:%M:%S.%N”
2019-11-03T13:59:27.977839613
To get current UTC time in the format you want.
--
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!
More information about the freebsd-questions
mailing list