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

Commit7f0b690

Browse files
committed
Improve comments for AdjustIntervalForTypmod.
Blank line adjustments.
1 parent62abb03 commit7f0b690

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

834834
#ifdefHAVE_INT64_TIMESTAMP
835835
int64span;
836-
837836
#else
838837
doublespan;
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
#ifdefHAVE_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
returninterval->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/1215:17:44 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.132 2005/07/1216:04:58 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -47,7 +47,6 @@ TimestampTz PgStartTime;
4747

4848
#ifdefHAVE_INT64_TIMESTAMP
4949
staticint64time2t(constinthour,constintmin,constintsec,constfsec_tfsec);
50-
5150
#else
5251
staticdoubletime2t(constinthour,constintmin,constintsec,constfsec_tfsec);
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
staticvoid
647649
AdjustIntervalForTypmod(Interval*interval,int32typmod)
648650
{
@@ -722,7 +724,6 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
722724
{
723725
#ifdefHAVE_INT64_TIMESTAMP
724726
int64day;
725-
726727
#else
727728
doubleday;
728729
#endif
@@ -744,7 +745,6 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
744745
{
745746
#ifdefHAVE_INT64_TIMESTAMP
746747
int64hour;
747-
748748
#else
749749
doublehour;
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 adjustsubsecondprecision? */
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
#ifdefHAVE_INT64_TIMESTAMP
992992
int64time;
993-
994993
#else
995994
doubletime;
996995
#endif
@@ -1171,7 +1170,6 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
11711170
#ifdefHAVE_INT64_TIMESTAMP
11721171
intdate;
11731172
int64time;
1174-
11751173
#else
11761174
doubledate,
11771175
time;
@@ -1211,7 +1209,6 @@ interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec)
12111209
{
12121210
#ifdefHAVE_INT64_TIMESTAMP
12131211
int64time;
1214-
12151212
#else
12161213
doubletime;
12171214
#endif
@@ -1648,7 +1645,6 @@ interval_cmp_internal(Interval *interval1, Interval *interval2)
16481645
#ifdefHAVE_INT64_TIMESTAMP
16491646
int64span1,
16501647
span2;
1651-
16521648
#else
16531649
doublespan1,
16541650
span2;
@@ -2192,7 +2188,6 @@ interval_mul(PG_FUNCTION_ARGS)
21922188

21932189
#ifdefHAVE_INT64_TIMESTAMP
21942190
int64months;
2195-
21962191
#else
21972192
doublemonths;
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
#ifdefHAVE_INT64_TIMESTAMP
12391239
int64time;
1240-
12411240
#else
12421241
doubletime;
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
#ifdefHAVE_INT64_TIMESTAMP
676676
int64time;
677-
678677
#else
679678
doubletime;
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
#ifdefHAVE_INT64_TIMESTAMP
105105
int64time;
106-
107106
#else
108107
doubletime;
109108
#endif
@@ -148,7 +147,6 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
148147
intdDate,
149148
date0;
150149
int64time;
151-
152150
#else
153151
doubledDate,
154152
date0;
@@ -280,7 +278,6 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr)
280278

281279
#ifdefHAVE_INT64_TIMESTAMP
282280
int64noresult=0;
283-
284281
#else
285282
doublenoresult=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
#ifdefHAVE_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)

[8]ページ先頭

©2009-2025 Movatter.jp