small code cleanup - gettimeofday() - Mailing list pgsql-patches
From | Andrew Dunstan |
---|---|
Subject | small code cleanup - gettimeofday() |
Date | |
Msg-id | 4358FD9B.3060706@dunslane.net Whole thread Raw |
Responses |
Re: small code cleanup - gettimeofday()
|
List | pgsql-patches |
The attached small patch removes the useless struct timezone argument to gettimeofday() in a few places and replaces it with NULL, bringing it into line with the rest of the code. If noone objects I will apply this soon. cheers andrew Index: src/backend/postmaster/postmaster.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v retrieving revision 1.471 diff -c -r1.471 postmaster.c *** src/backend/postmaster/postmaster.c 20 Oct 2005 20:05:44 -0000 1.471 --- src/backend/postmaster/postmaster.c 21 Oct 2005 14:34:15 -0000 *************** *** 1148,1156 **** last_touch_time; struct timeval earlier, later; - struct timezone tz; ! gettimeofday(&earlier, &tz); last_touch_time = time(NULL); nSockets = initMasks(&readmask); --- 1148,1155 ---- last_touch_time; struct timeval earlier, later; ! gettimeofday(&earlier, NULL); last_touch_time = time(NULL); nSockets = initMasks(&readmask); *************** *** 1207,1213 **** */ while (random_seed == 0) { ! gettimeofday(&later, &tz); /* * We are not sure how much precision is in tv_usec, so we --- 1206,1212 ---- */ while (random_seed == 0) { ! gettimeofday(&later, NULL); /* * We are not sure how much precision is in tv_usec, so we Index: src/backend/utils/adt/nabstime.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v retrieving revision 1.145 diff -c -r1.145 nabstime.c *** src/backend/utils/adt/nabstime.c 15 Oct 2005 02:49:29 -0000 1.145 --- src/backend/utils/adt/nabstime.c 21 Oct 2005 14:34:16 -0000 *************** *** 1584,1597 **** timeofday(PG_FUNCTION_ARGS) { struct timeval tp; - struct timezone tpz; char templ[128]; char buf[128]; text *result; int len; pg_time_t tt; ! gettimeofday(&tp, &tpz); tt = (pg_time_t) tp.tv_sec; pg_strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z", pg_localtime(&tt, global_timezone)); --- 1584,1596 ---- timeofday(PG_FUNCTION_ARGS) { struct timeval tp; char templ[128]; char buf[128]; text *result; int len; pg_time_t tt; ! gettimeofday(&tp, NULL); tt = (pg_time_t) tp.tv_sec; pg_strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z", pg_localtime(&tt, global_timezone)); Index: src/backend/utils/misc/pg_rusage.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/utils/misc/pg_rusage.c,v retrieving revision 1.2 diff -c -r1.2 pg_rusage.c *** src/backend/utils/misc/pg_rusage.c 15 Oct 2005 02:49:36 -0000 1.2 --- src/backend/utils/misc/pg_rusage.c 21 Oct 2005 14:34:16 -0000 *************** *** 26,35 **** void pg_rusage_init(PGRUsage *ru0) { - struct timezone tz; - getrusage(RUSAGE_SELF, &ru0->ru); ! gettimeofday(&ru0->tv, &tz); } /* --- 26,33 ---- void pg_rusage_init(PGRUsage *ru0) { getrusage(RUSAGE_SELF, &ru0->ru); ! gettimeofday(&ru0->tv, NULL); } /*
pgsql-patches by date: