comparison 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
comparison
equal deleted inserted replaced
1366:1595a738e4e9 1367:8301ee4ab58c
2514 struct tm stm; 2514 struct tm stm;
2515 2515
2516 if (localtime_r(&t.seconds, &stm)) { 2516 if (localtime_r(&t.seconds, &stm)) {
2517 s = uw_malloc(ctx, TIMES_MAX); 2517 s = uw_malloc(ctx, TIMES_MAX);
2518 len = strftime(s, TIMES_MAX, TIME_FMT_PG, &stm); 2518 len = strftime(s, TIMES_MAX, TIME_FMT_PG, &stm);
2519 r = uw_malloc(ctx, len + 14); 2519 if (t.microseconds) {
2520 sprintf(r, "'%s'::timestamp", s); 2520 r = uw_malloc(ctx, len + 21);
2521 sprintf(r, "'%s.%06u'::timestamp", s, t.microseconds);
2522 } else {
2523 r = uw_malloc(ctx, len + 14);
2524 sprintf(r, "'%s'::timestamp", s);
2525 }
2521 return r; 2526 return r;
2522 } else 2527 } else
2523 return "<Invalid time>"; 2528 return "<Invalid time>";
2524 } 2529 }
2525 2530