lib/timeutils: add common ISO timestamp masks
* Start the ISO format flags at bit 0 instead of bit 1. * Remove unnecessary _8601 from ISO format flag names to avoid line wrapping and to ease readability. * ISO timestamps have date-time-timzone in common, so move the TIMEZONE flag to bit 2 causing all timestamp masks to have the first three bits set and the last four bits as timestamp 'options'. * Change the 'SPACE' flag to a 'T' flag, because it makes the code and comments more concise. * Add common ISO timestamp masks. * Implement the ISO timestamp masks in all applicable code using the strxxx_iso() functions. Signed-off-by: J William Piggott <elseifthen@gmx.com>
This commit is contained in:
parent
9fd0a7a96c
commit
4111bb3ab5
11 changed files with 48 additions and 63 deletions
|
@ -224,17 +224,11 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid)
|
|||
}
|
||||
if (variant == UUID_VARIANT_DCE && type == 1) {
|
||||
struct timeval tv;
|
||||
char date_buf[ISO_8601_BUFSIZ + 4];
|
||||
char date_buf[ISO_BUFSIZ];
|
||||
|
||||
uuid_time(buf, &tv);
|
||||
strtimeval_iso(&tv,
|
||||
ISO_8601_DATE |
|
||||
ISO_8601_TIME |
|
||||
ISO_8601_COMMAUSEC |
|
||||
ISO_8601_TIMEZONE |
|
||||
ISO_8601_SPACE,
|
||||
date_buf,
|
||||
sizeof(date_buf));
|
||||
strtimeval_iso(&tv, ISO_TIMESTAMP_COMMA,
|
||||
date_buf, sizeof(date_buf));
|
||||
str = xstrdup(date_buf);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue