Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdadce65

Browse files
committed
Don't assume that struct timeval's tv_sec field is the same datatype as
time_t; on some platforms they are not the same width. Per Manfred Koizar.
1 parent1899203 commitdadce65

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/backend/utils/adt/nabstime.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.119 2004/03/22 15:34:22 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.120 2004/05/05 17:28:46 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -191,9 +191,9 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn)
191191
time-=CTimeZone;
192192

193193
if ((!HasCTZSet)&& (tzp!=NULL))
194-
tx=localtime((time_t*)&time);
194+
tx=localtime(&time);
195195
else
196-
tx=gmtime((time_t*)&time);
196+
tx=gmtime(&time);
197197

198198
tm->tm_year=tx->tm_year+1900;
199199
tm->tm_mon=tx->tm_mon+1;
@@ -1728,10 +1728,12 @@ timeofday(PG_FUNCTION_ARGS)
17281728
charbuf[128];
17291729
text*result;
17301730
intlen;
1731+
time_ttt;
17311732

17321733
gettimeofday(&tp,&tpz);
1734+
tt= (time_t)tp.tv_sec;
17331735
strftime(templ,sizeof(templ),"%a %b %d %H:%M:%S.%%06d %Y %Z",
1734-
localtime((time_t*)&tp.tv_sec));
1736+
localtime(&tt));
17351737
snprintf(buf,sizeof(buf),templ,tp.tv_usec);
17361738

17371739
len=VARHDRSZ+strlen(buf);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp