Mercurial > urweb
diff src/c/urweb.c @ 1410:55d0c8b01d18
Fix parsing of Postgres timestamps with super-microsecond fractional seconds, based on patch from Vladimir Shabanov
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 22 Jan 2011 10:53:06 -0500 |
parents | 6ab04cb0e4db |
children | 45bd58736bb2 |
line wrap: on
line diff
--- a/src/c/urweb.c Thu Jan 20 16:56:54 2011 -0500 +++ b/src/c/urweb.c Sat Jan 22 10:53:06 2011 -0500 @@ -2842,7 +2842,10 @@ *dot = 0; if (strptime(s, TIME_FMT_PG, &stm)) { *dot = '.'; - uw_Basis_time r = { mktime(&stm), atoi(dot+1) }; + char usec[] = "000000"; + int len = strlen(dot+1); + memcpy(usec, dot+1, len < 6 ? len : 6); + uw_Basis_time r = { mktime(&stm), atoi(usec) }; return r; } else {