提交 4dba6814 编写于 作者: T Tom Lane

Correct bogus output formatting of timeofday() function. A number of

microseconds < 100000 should be displayed as, eg, 13.000126, not 13.126.
上级 15903a1e
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.81 2001/02/13 14:32:52 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.82 2001/02/21 22:03:00 tgl Exp $
*
* NOTES
*
......@@ -1911,13 +1911,13 @@ timeofday(PG_FUNCTION_ARGS)
{
struct timeval tp;
struct timezone tpz;
char templ[500];
char buf[500];
char templ[100];
char buf[100];
text *result;
int len = 0;
int len;
gettimeofday(&tp, &tpz);
strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%d %Y %Z",
strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z",
localtime((time_t *) &tp.tv_sec));
snprintf(buf, sizeof(buf), templ, tp.tv_usec);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册