diff options
-rw-r--r-- | src/c/urweb.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c index 1f0bc1a8..1ac1622e 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -2516,8 +2516,13 @@ char *uw_Basis_sqlifyTime(uw_context ctx, uw_Basis_time t) { if (localtime_r(&t.seconds, &stm)) { s = uw_malloc(ctx, TIMES_MAX); len = strftime(s, TIMES_MAX, TIME_FMT_PG, &stm); - r = uw_malloc(ctx, len + 14); - sprintf(r, "'%s'::timestamp", s); + if (t.microseconds) { + r = uw_malloc(ctx, len + 21); + sprintf(r, "'%s.%06u'::timestamp", s, t.microseconds); + } else { + r = uw_malloc(ctx, len + 14); + sprintf(r, "'%s'::timestamp", s); + } return r; } else return "<Invalid time>"; |