Skip to content

Commit 7f0b690

Browse files
committed
Improve comments for AdjustIntervalForTypmod.
Blank line adjustments.
1 parent 62abb03 commit 7f0b690

File tree

6 files changed

+14
-25
lines changed

6 files changed

+14
-25
lines changed

src/backend/utils/adt/nabstime.c

Lines changed: 1 addition & 2 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.134 2005/06/29 22:51:56 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.135 2005/07/12 16:04:56 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -833,7 +833,6 @@ interval_reltime(PG_FUNCTION_ARGS)
833833

834834
#ifdef HAVE_INT64_TIMESTAMP
835835
int64 span;
836-
837836
#else
838837
double span;
839838
#endif

src/backend/utils/adt/selfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.183 2005/06/29 22:51:56 tgl Exp $
18+
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.184 2005/07/12 16:04:57 momjian Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -2802,7 +2802,7 @@ convert_timevalue_to_scalar(Datum value, Oid typid)
28022802

28032803
#ifdef HAVE_INT64_TIMESTAMP
28042804
if (interval->status != 0)
2805-
return ((interval->data[1] - interval->data[0]) *1000000.0);
2805+
return ((interval->data[1] - interval->data[0]) * 1000000.0);
28062806
#else
28072807
if (interval->status != 0)
28082808
return interval->data[1] - interval->data[0];

src/backend/utils/adt/timestamp.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.131 2005/07/12 15:17:44 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.132 2005/07/12 16:04:58 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -47,7 +47,6 @@ TimestampTz PgStartTime;
4747

4848
#ifdef HAVE_INT64_TIMESTAMP
4949
static int64 time2t(const int hour, const int min, const int sec, const fsec_t fsec);
50-
5150
#else
5251
static double time2t(const int hour, const int min, const int sec, const fsec_t fsec);
5352
#endif
@@ -642,7 +641,10 @@ interval_scale(PG_FUNCTION_ARGS)
642641

643642
PG_RETURN_INTERVAL_P(result);
644643
}
645-
644+
/*
645+
* Adjust interval for specified precision, in both YEAR to SECOND
646+
* range and sub-second precision.
647+
*/
646648
static void
647649
AdjustIntervalForTypmod(Interval *interval, int32 typmod)
648650
{
@@ -722,7 +724,6 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
722724
{
723725
#ifdef HAVE_INT64_TIMESTAMP
724726
int64 day;
725-
726727
#else
727728
double day;
728729
#endif
@@ -744,7 +745,6 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
744745
{
745746
#ifdef HAVE_INT64_TIMESTAMP
746747
int64 hour;
747-
748748
#else
749749
double hour;
750750
#endif
@@ -887,7 +887,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
887887
else
888888
elog(ERROR, "unrecognized interval typmod: %d", typmod);
889889

890-
/* Need to adjust precision? If not, don't even try! */
890+
/* Need to adjust subsecond precision? */
891891
if (precision != INTERVAL_FULL_PRECISION)
892892
{
893893
if (precision < 0 || precision > MAX_INTERVAL_PRECISION)
@@ -990,7 +990,6 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
990990
{
991991
#ifdef HAVE_INT64_TIMESTAMP
992992
int64 time;
993-
994993
#else
995994
double time;
996995
#endif
@@ -1171,7 +1170,6 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
11711170
#ifdef HAVE_INT64_TIMESTAMP
11721171
int date;
11731172
int64 time;
1174-
11751173
#else
11761174
double date,
11771175
time;
@@ -1211,7 +1209,6 @@ interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec)
12111209
{
12121210
#ifdef HAVE_INT64_TIMESTAMP
12131211
int64 time;
1214-
12151212
#else
12161213
double time;
12171214
#endif
@@ -1648,7 +1645,6 @@ interval_cmp_internal(Interval *interval1, Interval *interval2)
16481645
#ifdef HAVE_INT64_TIMESTAMP
16491646
int64 span1,
16501647
span2;
1651-
16521648
#else
16531649
double span1,
16541650
span2;
@@ -2192,7 +2188,6 @@ interval_mul(PG_FUNCTION_ARGS)
21922188

21932189
#ifdef HAVE_INT64_TIMESTAMP
21942190
int64 months;
2195-
21962191
#else
21972192
double months;
21982193
#endif

src/interfaces/ecpg/pgtypeslib/dt_common.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,6 @@ dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec)
12371237
{
12381238
#ifdef HAVE_INT64_TIMESTAMP
12391239
int64 time;
1240-
12411240
#else
12421241
double time;
12431242
#endif

src/interfaces/ecpg/pgtypeslib/interval.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
416416
sec = (*fsec / USECS_PER_SEC);
417417
*fsec -= (sec * USECS_PER_SEC);
418418
#else
419-
TMODULO(*fsec, sec, 1e0);
419+
TMODULO(*fsec, sec, 1.0);
420420
#endif
421421
tm->tm_sec += sec;
422422
}
@@ -674,7 +674,6 @@ interval2tm(interval span, struct tm * tm, fsec_t *fsec)
674674
{
675675
#ifdef HAVE_INT64_TIMESTAMP
676676
int64 time;
677-
678677
#else
679678
double time;
680679
#endif
@@ -704,9 +703,9 @@ interval2tm(interval span, struct tm * tm, fsec_t *fsec)
704703
*fsec = (time - (tm->tm_sec * USECS_PER_SEC));
705704
#else
706705
TMODULO(time, tm->tm_mday, (double)SECS_PER_DAY);
707-
TMODULO(time, tm->tm_hour, 3600e0);
708-
TMODULO(time, tm->tm_min, 60e0);
709-
TMODULO(time, tm->tm_sec, 1e0);
706+
TMODULO(time, tm->tm_hour, 3600.0);
707+
TMODULO(time, tm->tm_min, 60.0);
708+
TMODULO(time, tm->tm_sec, 1.0);
710709
*fsec = time;
711710
#endif
712711

src/interfaces/ecpg/pgtypeslib/timestamp.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ dt2time(timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
103103
{
104104
#ifdef HAVE_INT64_TIMESTAMP
105105
int64 time;
106-
107106
#else
108107
double time;
109108
#endif
@@ -148,7 +147,6 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
148147
int dDate,
149148
date0;
150149
int64 time;
151-
152150
#else
153151
double dDate,
154152
date0;
@@ -280,7 +278,6 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr)
280278

281279
#ifdef HAVE_INT64_TIMESTAMP
282280
int64 noresult = 0;
283-
284281
#else
285282
double noresult = 0.0;
286283
#endif
@@ -572,7 +569,7 @@ dttofmtasc_replace(timestamp *ts, date dDate, int dow, struct tm * tm,
572569
break;
573570
case 's':
574571
#ifdef HAVE_INT64_TIMESTAMP
575-
replace_val.int64_val = (*ts - SetEpochTimestamp()) / 1000000e0;
572+
replace_val.int64_val = (*ts - SetEpochTimestamp()) / 1000000.0;
576573
replace_type = PGTYPES_TYPE_INT64;
577574
#else
578575
replace_val.double_val = *ts - SetEpochTimestamp();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy