Re: [PATCH 05/11] uuidgen: add --date option to display time when uuid was generated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 08, 2017 at 08:52:09PM +0100, Sami Kerola wrote:
> The uuidgen has always had option to use time as a uuid value.  To common
> users these timestamps have been difficult to convert to readable format, so
> add an option to do that.

The name of the tool is uuidgen and at first glance it seems like
--date is a way how to use a different time than the current ;-)

Maybe it would be better to create a small independent tool uuidparse
and print all available details about UUID (variant, type and time).

 $ uuidparse  7e400110-3e4a-11e7-8af1-00037f500001
 variant: DCE
 type: time
 time: 2017-05-21 17:25:32,471528+0000

 $ uuidparse --time
 2017-05-21 17:25:32,471528+0000

 It would be also nice to accept more than one UUID on command line/stdin.

or so... Comments?

 See libuuid/src/uuid_time.c where is test program.

> +static int print_uuid_date(char *date)
> +{
> +	uuid_t uuid;
> +	struct timeval tv;
> +	char buf[ISO_8601_BUFSIZ];
> +
> +	if (uuid_parse(date, uuid)) {
> +		printf(_("invalid uuid: %s\n"), date);

 "failed to parse UUID" sounds better

> +		return 1;
> +	}

Maybe you want to check UUID type and variant, only DCE time is
supported.

I think separated pull request would be better ;-)

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux