Date: Sun, 10 Nov 2019 11:26:38 +0100 From: mj-mailinglist@gmx.de To: freebsd-questions@freebsd.org Subject: Aw: Re: How to convert svn repository change date to epoch timestamp? Message-ID: <trinity-773058f0-8df4-4aed-ada6-def6d3631365-1573381598064@3c-app-gmx-bs64> In-Reply-To: <e1a46469-254b-cefe-3f7e-a200f0f8736b@hedeland.org> References: <trinity-0e118d1a-6b7c-4c5e-a0b8-2b6fceb1e713-1572782605441@3c-app-gmx-bs36> <alpine.BSF.2.21.99999.352.1911031724370.5571@enterprise.ximalas.info> <alpine.BSF.2.21.99999.352.1911031732260.5571@enterprise.ximalas.info> <e1a46469-254b-cefe-3f7e-a200f0f8736b@hedeland.org>
next in thread | previous in thread | raw e-mail | index | archive | help
>>> date -juf "%FT%TZ" `svnlite info --no-newline --show-item last-changed= -date /usr/src | sed 's/\.[0-9]*Z$/Z/'` "+%s" >> >> Even simpler: >> >> date -juf "%FT%T" `svnlite info --no-newline --show-item last-changed-d= ate /usr/src | sed 's/\.[0-9]*Z$//'` "+%s" > > Simpler still, if you don't mind the warning: > > $ date -juf "%FT%T" `svnlite info --show-item last-changed-date /usr/por= ts` +%s > Warning: Ignoring 8 extraneous characters in date string (.012563Z) > 1572745647 > > But I have to admit that GNU 'date', mentioned in another post, really > beats FreeBSD 'date' here, since it can parse the ISO 8601 format, > including the fractional second and the "Z" a.k.a. UTC time zone, > without even being given a format spec: > > $ uname -a > Linux ... > $ date -d 2019-11-03T07:11:09.005639Z +%s.%N > 1572765069.005639000 > > Alas, it is not among "the tools in base", and in the general case, I > guess there may be "reasonable doubt" as to whether its parsing is > actually correct (it isn't *possible* to give a format spec). But for > a correctly formed 8601 date/time, it should absolutely be OK. > > --Per Thanks everyone, i am going with the sed part. Is this the only place in FreeBSD where the = ISO 8601 format including fractions of seconds is used? There was a patch for adding it as an option to syslogd (https://reviews.f= reebsd.org/D14918), but that was not commited Wouldn't it be best, if date is extended to handle the fraction part offic= ialy? I looked at the code, but have no idea where to start. =2D- Martin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?trinity-773058f0-8df4-4aed-ada6-def6d3631365-1573381598064>