Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4dba681

Browse files
committed
Correct bogus output formatting of timeofday() function. A number of
microseconds < 100000 should be displayed as, eg, 13.000126, not 13.126.
1 parent 15903a1 commit 4dba681

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/utils/adt/nabstime.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.81 2001/02/13 14:32:52 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.82 2001/02/21 22:03:00 tgl Exp $
1313
*
1414
* NOTES
1515
*
@@ -1911,13 +1911,13 @@ timeofday(PG_FUNCTION_ARGS)
19111911
{
19121912
struct timeval tp;
19131913
struct timezone tpz;
1914-
char templ[500];
1915-
char buf[500];
1914+
char templ[100];
1915+
char buf[100];
19161916
text *result;
1917-
int len = 0;
1917+
int len;
19181918

19191919
gettimeofday(&tp, &tpz);
1920-
strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%d %Y %Z",
1920+
strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z",
19211921
localtime((time_t *) &tp.tv_sec));
19221922
snprintf(buf, sizeof(buf), templ, tp.tv_usec);
19231923

0 commit comments

Comments
 (0)