Mercurial > urweb
changeset 1367:8301ee4ab58c
Include microseconds in uw_Basis_sqlifyTime() output
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 25 Dec 2010 08:58:25 -0500 (2010-12-25) |
parents | 1595a738e4e9 |
children | b2bc8bcd546f |
files | src/c/urweb.c |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/c/urweb.c Fri Dec 24 18:55:13 2010 -0500 +++ b/src/c/urweb.c Sat Dec 25 08:58:25 2010 -0500 @@ -2516,8 +2516,13 @@ 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>";