Skip to content

Commit 9b5fab1

Browse files
author
Nikita Glukhov
committed
Preliminary datetime infrastructure
1 parent afc4a78 commit 9b5fab1

File tree

13 files changed

+639
-34
lines changed

13 files changed

+639
-34
lines changed

doc/src/sgml/func.sgml

+24
Original file line numberDiff line numberDiff line change
@@ -5989,6 +5989,30 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
59895989
<entry><literal>US</literal></entry>
59905990
<entry>microsecond (000000-999999)</entry>
59915991
</row>
5992+
<row>
5993+
<entry><literal>FF1</literal></entry>
5994+
<entry>decisecond (0-9)</entry>
5995+
</row>
5996+
<row>
5997+
<entry><literal>FF2</literal></entry>
5998+
<entry>centisecond (00-99)</entry>
5999+
</row>
6000+
<row>
6001+
<entry><literal>FF3</literal></entry>
6002+
<entry>millisecond (000-999)</entry>
6003+
</row>
6004+
<row>
6005+
<entry><literal>FF4</literal></entry>
6006+
<entry>tenth of a millisecond (0000-9999)</entry>
6007+
</row>
6008+
<row>
6009+
<entry><literal>FF5</literal></entry>
6010+
<entry>hundredth of a millisecond (00000-99999)</entry>
6011+
</row>
6012+
<row>
6013+
<entry><literal>FF6</literal></entry>
6014+
<entry>microsecond (000000-999999)</entry>
6015+
</row>
59926016
<row>
59936017
<entry><literal>SSSS</literal></entry>
59946018
<entry>seconds past midnight (0-86399)</entry>

src/backend/utils/adt/date.c

+3-8
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040
#endif
4141

4242

43-
static int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result);
44-
static int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result);
45-
static void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
46-
47-
4843
/* common code for timetypmodin and timetztypmodin */
4944
static int32
5045
anytime_typmodin(bool istz, ArrayType *ta)
@@ -1210,7 +1205,7 @@ time_in(PG_FUNCTION_ARGS)
12101205
/* tm2time()
12111206
* Convert a tm structure to a time data type.
12121207
*/
1213-
static int
1208+
int
12141209
tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result)
12151210
{
12161211
*result = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec)
@@ -1376,7 +1371,7 @@ time_scale(PG_FUNCTION_ARGS)
13761371
* have a fundamental tie together but rather a coincidence of
13771372
* implementation. - thomas
13781373
*/
1379-
static void
1374+
void
13801375
AdjustTimeForTypmod(TimeADT *time, int32 typmod)
13811376
{
13821377
static const int64 TimeScales[MAX_TIME_PRECISION + 1] = {
@@ -1954,7 +1949,7 @@ time_part(PG_FUNCTION_ARGS)
19541949
/* tm2timetz()
19551950
* Convert a tm structure to a time data type.
19561951
*/
1957-
static int
1952+
int
19581953
tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result)
19591954
{
19601955
result->time = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) *

0 commit comments

Comments
 (0)