comparison 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
comparison
equal deleted inserted replaced
1409:6ab04cb0e4db 1410:55d0c8b01d18
2840 2840
2841 if (dot) { 2841 if (dot) {
2842 *dot = 0; 2842 *dot = 0;
2843 if (strptime(s, TIME_FMT_PG, &stm)) { 2843 if (strptime(s, TIME_FMT_PG, &stm)) {
2844 *dot = '.'; 2844 *dot = '.';
2845 uw_Basis_time r = { mktime(&stm), atoi(dot+1) }; 2845 char usec[] = "000000";
2846 int len = strlen(dot+1);
2847 memcpy(usec, dot+1, len < 6 ? len : 6);
2848 uw_Basis_time r = { mktime(&stm), atoi(usec) };
2846 return r; 2849 return r;
2847 } 2850 }
2848 else { 2851 else {
2849 *dot = '.'; 2852 *dot = '.';
2850 uw_error(ctx, FATAL, "Can't parse time: %s", s); 2853 uw_error(ctx, FATAL, "Can't parse time: %s", s);