Commit 4dba6814 authored by Tom Lane's avatar Tom Lane

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

microseconds < 100000 should be displayed as, eg, 13.000126, not 13.126.
parent 15903a1e
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* *
...@@ -1911,13 +1911,13 @@ timeofday(PG_FUNCTION_ARGS) ...@@ -1911,13 +1911,13 @@ timeofday(PG_FUNCTION_ARGS)
{ {
struct timeval tp; struct timeval tp;
struct timezone tpz; struct timezone tpz;
char templ[500]; char templ[100];
char buf[500]; char buf[100];
text *result; text *result;
int len = 0; int len;
gettimeofday(&tp, &tpz); 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)); localtime((time_t *) &tp.tv_sec));
snprintf(buf, sizeof(buf), templ, tp.tv_usec); snprintf(buf, sizeof(buf), templ, tp.tv_usec);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment