aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-30 13:55:55 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-30 13:55:55 -0400
commitec0606091bdcc8a8473ba909fb8ca2d873ce4a59 (patch)
tree4b490161bf0a0b91e24c7af6bb1e84d439dd5951 /compile.c
parent45425b77e40da59552cc800313aa80aac88430d4 (diff)
Add datetime literal and tests
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index f1c27328..744ac95f 100644
--- a/compile.c
+++ b/compile.c
@@ -1850,6 +1850,10 @@ CORD compile(env_t *env, ast_t *ast)
return compile_null(t);
}
case Bool: return Match(ast, Bool)->b ? "yes" : "no";
+ case DateTime: {
+ auto dt = Match(ast, DateTime)->dt;
+ return CORD_asprintf("((DateTime_t){.tv_sec=%ld, .tv_usec=%ld})", dt.tv_sec, dt.tv_usec);
+ }
case Var: {
binding_t *b = get_binding(env, Match(ast, Var)->name);
if (b)