Mercurial > urweb
diff src/c/urweb.c @ 1367:8301ee4ab58c
Include microseconds in uw_Basis_sqlifyTime() output
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 25 Dec 2010 08:58:25 -0500 |
parents | b02cb9da5686 |
children | 1a78ca089bd0 |
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>";