diff --git a/libkc3/buf_inspect.c b/libkc3/buf_inspect.c
index 781930e..26fb1d7 100644
--- a/libkc3/buf_inspect.c
+++ b/libkc3/buf_inspect.c
@@ -3731,18 +3731,47 @@ sw buf_inspect_time (s_buf *buf, const s_time *time)
{
sw r;
sw result = 0;
- if ((r = buf_write_1(buf, "%Time{tv_sec: ")) < 0)
- return r;
- result += r;
- if ((r = buf_inspect_sw(buf, &time->tv_sec)) < 0)
- return r;
- result += r;
- if ((r = buf_write_1(buf, ", tv_nsec: ")) < 0)
- return r;
- result += r;
- if ((r = buf_inspect_sw(buf, &time->tv_nsec)) < 0)
+ bool sec;
+ if ((r = buf_write_1(buf, "%Time{")) < 0)
return r;
result += r;
+ if ((sec = time->tag ?
+ time->tag->type != TAG_SW || time->tag->data.sw :
+ time->tv_sec)) {
+ if ((r = buf_write_1(buf, "tv_sec: ")) < 0)
+ return r;
+ result += r;
+ if (time->tag) {
+ if ((r = buf_inspect_tag(buf, time->tag)) < 0)
+ return r;
+ }
+ else {
+ if ((r = buf_inspect_sw_decimal(buf, &time->tv_sec)) < 0)
+ return r;
+ }
+ result += r;
+ }
+ if (time->tag ?
+ time->tag[1].type != TAG_SW || time->tag[1].data.sw :
+ time->tv_nsec) {
+ if (sec) {
+ if ((r = buf_write_1(buf, ", ")) < 0)
+ return r;
+ result += r;
+ }
+ if ((r = buf_write_1(buf, "tv_nsec: ")) < 0)
+ return r;
+ result += r;
+ if (time->tag) {
+ if ((r = buf_inspect_tag(buf, time->tag + 1)) < 0)
+ return r;
+ }
+ else {
+ if ((r = buf_inspect_sw_decimal(buf, &time->tv_nsec)) < 0)
+ return r;
+ }
+ result += r;
+ }
if ((r = buf_write_1(buf, "}")) < 0)
return r;
result += r;
diff --git a/libkc3/env.c b/libkc3/env.c
index d16e177..ff4ef47 100644
--- a/libkc3/env.c
+++ b/libkc3/env.c
@@ -1811,6 +1811,7 @@ bool env_eval_quote_time (s_env *env, const s_time *time, s_tag *dest)
else {
tmp.tv_sec = time->tv_sec;
tmp.tv_nsec = time->tv_nsec;
+ tmp.tag = NULL;
}
dest->type = TAG_TIME;
dest->data.time = tmp;
diff --git a/libkc3/time.c b/libkc3/time.c
index 1909834..f9f3467 100644
--- a/libkc3/time.c
+++ b/libkc3/time.c
@@ -148,15 +148,3 @@ s_str * time_to_str (const s_time *time, s_str *dest)
}
return str_init_copy_1(dest, a);
}
-
-s_tag * time_to_tag (const s_timespec *time, s_tag *dest)
-{
- s_tag tmp = {0};
- assert(time);
- if (! tag_init_tuple(&tmp, 2))
- return NULL;
- tag_init_s64(&tmp.data.tuple.tag[0], time->tv_sec);
- tag_init_s64(&tmp.data.tuple.tag[1], time->tv_nsec);
- *dest = tmp;
- return dest;
-}
diff --git a/test/ikc3/time.out.expected b/test/ikc3/time.out.expected
index db720df..dc5cc2e 100644
--- a/test/ikc3/time.out.expected
+++ b/test/ikc3/time.out.expected
@@ -1,4 +1,4 @@
-%Time{tv_sec: (Sw) 0, tv_nsec: (Sw) 0}
-%Time{tv_sec: (Sw) 0, tv_nsec: (Sw) 0}
-Str.ftime(%Time{tv_sec: (Sw) 0, tv_nsec: (Sw) 0}, "%a, %b %d %G %T %Z")
+%Time{}
+%Time{}
+Str.ftime(%Time{}, "%a, %b %d %G %T %Z")
"Thu, Jan 01 1970 00:00:00 GMT"