return sizeof(bool);
case TABLE_TIMESTAMP:
+ case TABLE_TIMESTAMP_UTC:
+ case TABLE_TIMESTAMP_RELATIVE:
case TABLE_TIMESPAN:
case TABLE_TIMESPAN_MSEC:
return sizeof(usec_t);
break;
case TABLE_TIMESTAMP:
+ case TABLE_TIMESTAMP_UTC:
+ case TABLE_TIMESTAMP_RELATIVE:
case TABLE_TIMESPAN:
case TABLE_TIMESPAN_MSEC:
buffer.usec = va_arg(ap, usec_t);
return 0;
case TABLE_TIMESTAMP:
+ case TABLE_TIMESTAMP_UTC:
+ case TABLE_TIMESTAMP_RELATIVE:
return CMP(a->timestamp, b->timestamp);
case TABLE_TIMESPAN:
case TABLE_BOOLEAN:
return yes_no(d->boolean);
- case TABLE_TIMESTAMP: {
+ case TABLE_TIMESTAMP:
+ case TABLE_TIMESTAMP_UTC:
+ case TABLE_TIMESTAMP_RELATIVE: {
_cleanup_free_ char *p;
+ char *ret;
p = new(char, FORMAT_TIMESTAMP_MAX);
if (!p)
return NULL;
- if (!format_timestamp(p, FORMAT_TIMESTAMP_MAX, d->timestamp))
+ if (d->type == TABLE_TIMESTAMP)
+ ret = format_timestamp(p, FORMAT_TIMESTAMP_MAX, d->timestamp);
+ else if (d->type == TABLE_TIMESTAMP_UTC)
+ ret = format_timestamp_utc(p, FORMAT_TIMESTAMP_MAX, d->timestamp);
+ else
+ ret = format_timestamp_relative(p, FORMAT_TIMESTAMP_MAX, d->timestamp);
+ if (!ret)
return "n/a";
d->formatted = TAKE_PTR(p);
return json_variant_new_boolean(ret, d->boolean);
case TABLE_TIMESTAMP:
+ case TABLE_TIMESTAMP_UTC:
+ case TABLE_TIMESTAMP_RELATIVE:
if (d->timestamp == USEC_INFINITY)
return json_variant_new_null(ret);