Mercurial > urweb
changeset 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 | 38d950c06dce |
files | src/c/urweb.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
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 {