[buildd-tools-devel] Bug#834736: Bug#834736: sbuild: Use basic format for ISO 8601 timestamps (for build logs filenames)

Santiago Vila sanvila at unex.es
Thu Aug 18 17:31:30 UTC 2016


On Thu, Aug 18, 2016 at 07:17:00PM +0200, Johannes Schauer wrote:
> Hi,
> 
> Quoting Santiago Vila (2016-08-18 15:01:53)
> > However, the way I read this:
> > 
> > https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations
> > 
> > there are still two allowed ways to specify the dates and the times:
> > the "basic format" and the "extended format".
> > 
> > Both are standard and both are equally correct, but I wish there would
> > be a way to use the basic format instead of the extended format, at least
> > for the filenames of the build logs, if only because 20160818T113412Z
> > is a lot easier to parse than 2016-08-18T11:34:12Z for further
> > processing.
> 
> I'm confused about what the problem is that you want to report.
> 
> The current format of the datetime stamp in build log filenames is:
> 
> 	2016-08-18T17:09:36Z
> 
> To parse that you write in most programming languages something like:
> 
> 	strptime("2016-08-18T17:09:36Z", "%FT%TZ")
> 
> To parse a string like:
> 
> 	20160818T113412Z
> 
> You would write:
> 
> 	strptime("20160818T113412Z", "%Y%m%dT%H%M%SZ")
> 
> I find the former format string much easier and shorter than the one to parse
> the latter.
> 
> So how is the latter easier to parse?

Try doing that in standard AWK without those fancy time-handling functions :-)

For the basic format it would be something like this:

date=substr(stamp,1,8)
time=substr(stamp,10,6)

I leave the extended format as an exercise for the reader.

It is in this sense that I said "easier to parse".


Also: The extended format makes the filename a little bit longer and a
little bit more difficult to handle, as the ":" has to be escaped.


In either case: Nobody asked for a way to specify the filename format
in a flexible way? For example: If I wanted an integer suffix meaning
the number of seconds since the epoch, how I would do that?

Thanks.



More information about the Buildd-tools-devel mailing list